-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The maximum line length of 120 has been exceeded. The rule cannot be modified or disabled. #1496
Comments
Please update to latest version of ktlint (0.45.2) first and report back if the problem still occurs. |
@paul-dingemans Updated the version and edited the question. The problem persists. I seem to be doing something wrong |
I tried to specify the full path to the .editorConfig file, but it did not help |
Based on your last screendump, I get the feeling that you only epxerience the problem with ktolin script (*.kts) files. That is caused by the space before |
Please read documentation. https://github.com/pinterest/ktlint#trailing-comma |
I was already happy, but deleting this space didn’t help either. (I even deleted everything else and left it as on the screen, but that doesn’t help either. I cleared the cache in android studio, all to no avail. |
In screenshot above you have set If error still occurs then please paste the source code instead of only providing a screenshot. |
Here are my settings. In the logs, I get a message about exceeding 100 characters, although I set 105 for the experiment. It is noteworthy that I commented out the android.set(true) line |
it is also not clear where it is better to write disabled_rules in gradle or in .editorConfig and which entry has a higher priority |
The ktlint gradle plugin is maintained in another project, so I can not be 100% sure what is happening. From the perspective of Ktlint, I can say that:
|
I can confirm that the check cannot be disabled. I think there's something wrong with editorconfig inheritance, for example, if I put Looks like ktlint respects only root-level declaration. |
@sanyarnd I am happy to look into this, if you can document the full reproduction path including sources to be used, commands being executed and output (using option |
sample project ktlint-max-length-bug.zip
|
I can not reproduce the problem with your sample project. What OS are you running on? Based on the backslashed in the path, it looks like Windows. When I run command:
Please send your complete output of command Please also note that the "space" in |
Tested 0.47.0 and error is gone now |
Ok, tnx for confirming. |
@Turalllb This is a little late but it seems like |
funny enough |
I am not sure what you mean. Do you care to explain? |
@Kashif-E kashif mamba jumba, do you damn care to explain? |
@mchelombitkopax8 the keyword is not max_line_length_ but max-line-length |
@mchelombitkopax8 You can try suppressing both rules |
The proper way to suppress this rule is:
But of course this only works for violations created by this rule specifically. |
ktlint {
version.set("0.45.2")
android.set(true)
additionalEditorconfigFile.set(file("/my-android/.editorconfig"))
disabledRules.set(Set.of("max_line_length", "import-ordering", "no-wildcard-imports", "final-newline", "missing-newline-after", "no-unused-imports", "indent"))
}
}
Result: Exceeded max line length (100) (cannot be auto-corrected)
With these settings, I keep getting an error about exceeding 100 characters. What could I set up wrong, why is everything so not obvious (
Also tell me, is it possible to disable the rule that prohibits putting a comma at the end of the enumeration, for example, in the class constructor after the very last argument? I would like to be able to put a comma, ide allows me to do this, but ktlint does not
version 10.3.0
The text was updated successfully, but these errors were encountered: