-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Allow ignoring of errors #125
Comments
Thanks for asking! I'm not keen on this approach, really. |
Ok, thanks for the clarification. |
Not allowing disabling errors assumes that package-lint is perfect, and it isn't (and neither is any other linter I've ever used). It gives a lot of false positives. I'd love to be able to fail a build if linting fails, but I can't do that if there isn't some way to silence incorrect warnings. Please reconsider this if it is feasible to add something like per-line ignore comments. Here is just one example of invalid warnings:
It is impossible to both integrate correctly with use-package and not have these errors. Package lint complains if |
I can see how that's an issue for conventions like
One key goal of |
It's not a matter of convention. I'm fine with (most of) package-lint's conventions, but some package-lint warnings/errors gives are for things that are actually fine. Separators is just one example. If a warning is wrong, and I can't mark that I've looked at it and confirmed it's wrong/irrelevant, then I can't use package-lint automatically. If I can't use package-lint automatically, it is much less useful. Even using it with flycheck or manually, incorrect warnings add a lot of noise. I think it's impossible for package-lint to be perfect at detecting violations. This is why most linters let you ignore errors/warnings. |
Thank you, yes, I do understand what you mean. I'm just not going to rush into making it possible to turn off warnings if they can instead be made more reliable.
Are you saying you think
That's one theory. Another is that many linters let you ignore errors/warnings because individual companies have disparate standards. |
Even if I was certain this was possible, I don't think I would agree with not allowing ignoring warnings. Let's say it's possible for package-lint to be perfect and then reliably be perfect forever. Before it is, it can't be used reliably to fail a CI run if there are any false positives. Coming at it from the perspective of having to deal with other packages that don't meet the package-lint conventions, is it really better to add exceptions for specific packages than to just allow ignoring warnings? What is the harm in supporting this? For the use case of a MELPA reviewer looking at packages, package-lint could just support showing all warnings regardless of configuration. For packages already on MELPA (or that won't be on MELPA), developers can already just ignore some package-lint errors if they don't like its conventions already. Allowing silencing them doesn't affect enforcing the conventions. Again, this is not what I want to do. I want this functionality so that I can more easily ensure my code meets package-lint conventions. I don't understand the reasoning against allowing this (unless the concern is the difficulty/time needed). Here are some more examples where I don't see how it would be possible to be perfect:
Question:
I think not allowing
Sure, there are multiple reasons ignoring warnings is useful. It would be wrong to say that either is the only reason. Allowing completely ignoring a certain warning can be useful when there are differing conventions (but sometimes a warning is just broken too often to be useful). Ignoring warnings per line is most often useful for handling invalid messages; if it was just about standards, I don't think per line ignores would be very useful (but maybe there is some use case I haven't encountered). I've never seen a non-trivial linter that didn't generate incorrect messages even when following its standards. Realistically, I don't see how this is fixable without allowing ignoring warnings. I guess you could pull out potentially imperfect messages into a separate category in order to not fail a CI run, but this would still be extra noise. From my perspective, I'd rather just be able to look at something like a prefix warning, confirm that there is no issue, mark it as reviewed, and then never see it again. In this scenario, I don't have to rely on package-lint being perfect, and package-lint doesn't have even have to try to handle something like trying to determine if a prefix might actually be valid in certain edge cases. |
As of a couple of days ago you can optionally ignore warnings in CI builds. |
Thanks, that's an improvement, but a lot of the false positives I mentioned are currently errors and not warnings (e.g. prefix and separator errors). Ideally I'd like to have warnings fail the build though. This also doesn't help with the noise issue. Would you accept a PR adding support for optionally checking per-line ignores? |
If the goal is to try to promote the standard suggested by package-lint and discourage alternatives, how about only allowing per-line ignores for messages known not to be perfect? Would this be an acceptable compromise? I only care about dealing with false positives. Example implementation: Add a variable for turning on per-line ignores. Add an optional argument to |
Adding my 2c. I stopped using this package because I can't keep my non conforming single function name that I want to keep for backwards compatibility. I think this is sad because this package is so useful and have improved my package considerably. With that said I think you should follow your vision for this package. If you change your mind though, I would gladly pick it up again. |
You can change the function name and use |
I'm stumbling upon the
Like the c/c++ checker clang-tidy is doing:
|
Better would be if you share the code and perhaps I can suggest a better alternative. :-) |
I'd appreciate that :) https://github.com/canatella/xwidget-plus/blob/master/xwidget-plus-follow-link.el . My package augments |
That's actually quite a clear case for small separate packages which actually have the appropriate dependencies. You could still keep them in the same repo, so - for example - you'd have an |
In order to maintain compatibility with Emacs 24 I've added
and
What should I do in this situation? |
@rnkn The elisp coding conventions document covers this -- search for the example referring to |
@purcell thanks! |
Is the correct thing in this case to also have them be separate recipes on MELPA? I'm trying to use package-lint for CI again. I am developing a new package, so I don't have to worry about maintaining backwards-compatibility and will switch to separate packages for previously optional dependencies. I am still blocked by the use-package issue though. This results in 4-6 errors per use-package keyword, and I am writing a package that adds a lot of use-package keywords. To deal with use-package's extension system, can the prefix and separator checkers specifically look for Some more minor questions:
|
Yes
Yes, potentially. See
Maybe? But the example is a bit odd, I feel like I'm missing context. Is that another upstream package symbol naming convention?
If I'm understanding this correctly, you could put the recording functionality at the top level of a separate file, and put the "display this thing in a buffer" command in the same file, autoloaded. |
Thanks, I can make a PR.
It was my naming convention. This is not a big deal though because I'm rewriting the package and will use a saner extension mechanism rather than following use-package's lead for how to add new keywords again.
Right now, the recording and display functions are both in a separate package. The display command is autoloaded. The recording functionality is meant to be used in functions that will run in a user's init.el, but I don't want to actually load the package or do any recording until the user needs it. This is not a real example, but hopefully it demonstrates what I mean: ;; my package provides something like this
(defun my-define-key (keymap key definition)
(with-eval-after-load 'record-things
(record-things keymap key definition))
(keymap-set keymap key definition))
;; user's init.el will call my-define-key That's currently how it's done to prevent recording taking up extra time during initialization for the user's key definitions (since recording involves some extra processing). I can't think of a better way around this. I could use a hook or store the information in some other way, but that doesn't really seem better. |
Okay, but that means someone else needs to load |
If the command is running, then the package will have already loaded, and the data will have been recorded. I'm not sure I made it clear that there is a single package doing both the recording and the display/describing (no external packages access the recorded data). Is your suggestion to temporarily store the information in a variable, and then later call a function to record and clear the stored information from that variable? |
As you noticed with You can argue that using |
Use-package requires using these prefixes to define new keywords. Following up on discussion in purcell#125.
Thanks for a great package.
Have you considered something like a white list or ignore list to allow specific constructs that violates some rule in
package-lint
?This would allow to check major part of a package and new additions while keep older violating constructs for backwards compatibility.
I've found #94 but that was closed since the author changed his package, it seems.
The text was updated successfully, but these errors were encountered: