29 ms·
GitHub Super Linter: one linter to rule them all
- iampims 6y agoI wish this would also prevent creating PRs that don’t pass the lint rules. It reduces churn on PR reviewers.
- beart 6y agoYou could use something like https://github.com/typicode/husky https://github.com/typicode/husky to prevent a push if the linter fails.
- iampims 6y agoMy (small) issue with git hooks, is that they need be installed everywhere for them to be 100% enforced. Works fine for small teams, but doesn’t scale that well beyond that.
- azemetre 6y agoYou make the hooks as part of the CI process. That's where something like husky can come in. We do this on my team. If you're trying to enforce something locally you can definitely enforce it on CI automatically. Once people realized their PRs were failing due to linting issues they started checking them locally as well.
- sorahn 6y agoThis is what we use. Husky runs linters on pre-commit to ensure everything is linted going into the repo.
- ccktlmazeltov 6y agothat's what github actions are for.
- ufo 6y agoWe added linter checks to our Travis CI config. It helps flag the PRs that don't pass the linter. The problem I've seen is that the error message isn't obvious. It just says that the "build failed", which sounds more like a compilation error than a lint problem.
- mfer 6y agohttps://xkcd.com/927/ https://xkcd.com/927/
- duckerude 6y agoNot particularly, I think. It's just bundling a ton of existing linters, not competing with them. What is it competing with?
- LibertyBeta 6y agoSo, this looks interesting. Rather than a real new linter, Github is proposing a tool that runs against a number of common linting standards with a single shared standard library. Perhaps it would have been better pitched a Lint-runner for CI jobs rather than a real linter.
- zkoppert 6y agoNever thought of that! That does seem more accurate and descriptive.
- nemetroid 6y agoAgreed. The headline and article had me believe that this was some language-agnostic linter framework. Which I guess it is in a sense, but it's only the dispatching part that's language-agnostic.
- crucialfelix 6y agoThe primary feature is the integration with Actions. Surprisingly most linter actions don't give you inline annotations. For each linter you have to find a separate solution. Css Eslint Etc I ended up using jest and the linter plugins for that, just so I would get readable inline reports. Otherwise it just fails and my devs have to search for the raw log in the checks panel. I didn't do any others because it's too much work to set up and runs longer, burns more carbon.
- tomaszs 6y agoI like the way it improves the quality of deploys. Actually different approach but same aim is hidden behind Assistant extension to Visual Studio Code. I think both solutions are complementary to improve quality of team work. If you want to check Assistant out version 0.9.0 was just released two days ago: https://marketplace.visualstudio.com/items?itemName=tomasz-smykowski.assistant https://marketplace.visualstudio.com/items?itemName=tomasz-s...
- acasajus 6y agoIt would be nice if you said that it's your own extension...
- tomaszs 6y agoMy name is Tomasz Smykowski. Assistant is my design. And I am proud of it!
- zkoppert 6y agoThanks for sharing that! I didn't know it existed.
- tomaszs 6y agoSounds great! I am sure you will enjoy it. If you have any feedback let me know. Cheers!
- mfontani 6y agoYay for (some) Perl support! The Perl validation seems to be restricted to "compile with warnings", despite "perlcritic" being now almost 15 years old, predating both some other linters' and even some other languages' very existence. I'll try to see how feasible it'd be to add it as a ("the"?) Perl linter to be used as using just the compilation step to infer everything's fine doesn't really satisfy the role a linter is meant to have.
- zkoppert 6y agoYes please! Feel free to open up an issue and collaborate with others to get it added! https://github.com/github/super-linter/issues https://github.com/github/super-linter/issues
- jwilk 6y agoAlso note that "perl -c" can't be used securely against untrusted code: $ echo 'BEGIN{`cowsay pwned > /dev/tty`}' > test.pm $ perl -Mstrict -cw test.pm _______ < pwned > ------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || test.pm syntax OK
- obrajesse 6y agoAlso, it looks like the perl linter only triggers against .pl files and not .pm files
- deleted 6y ago[deleted]
- oefrha 6y agoA problem I can see with this super linter is that it seems be written exclusively for GitHub Actions; there's no local install option. (I didn't read the code, maybe you can use lib/linter.sh directly, but it's certainly not directly supported.) So contributors have to rely on the CI feedback loop to see if their changes are compliant (insert fencing comic here)... Or more realistically, still use whatever linters they've been using so far, but now you have to maintain linter configs in two places. I get why it's probably not ideal as a local tool, and integration with Status API is nice and all, but I personally prefer to see devs linting their code before pushing for review. Correction: it can run locally in Docker, as pointed out below: https://github.com/github/super-linter/blob/master/docs/run-linter-locally.md https://github.com/github/super-linter/blob/master/docs/run-...
- zkoppert 6y agoHi, there is a local run option with instructions here: https://github.com/github/super-linter/blob/master/docs/run-linter-locally.md https://github.com/github/super-linter/blob/master/docs/run-...
- FalconSensei 6y agoHave to install docker to run a linter... Nah, thanks.
- GaryNumanVevo 6y agoDocker is probably the least annoying solution, would you rather install linters for 40 different languages on your system?
- ori_b 6y agoI'd rather not run a linux VM for this, so yes. It should be possible to isolate it to /opt/github-linter/* on my BSD machines, or put into a nix package. (Also, I guess this is one more reason that docker is a big red flag for 'hastily hacked together unportable software that would be hell to ship.')
- globular-toast 6y ago> Setting up a new repository with all the right linters for the different types of code can be time consuming and tedious. Is it? In my company I maintain a set of exemplars for all of our commonly used repository types. When someone wants to make a new one they just copy and paste stuff from one of the exemplars. Over the years I've come to value "white box" code re-use over "black box" re-use. In my experience many projects will outgrow their tools and need custom tooling, so it makes sense to keep the black boxes tiny and copy over large tooling in a white box fashion. For example, what if I want to change the Python linter for Pylint to flake8? I'll need a separate fork of superlinter or something. I'd prefer to just edit the tooling that is build in to my project.
- kstenerud 6y agoSo basically you've done the same as super linter at your company. But now, nobody else has to go through the pain of setting all of the exemplars up, because you get nice defaults, everything included for free from super linter.
- silviogutierrez 6y agoThis is great, but desperately needs a way to also fix these issues. And all functionality should run locally as well. I imagine the latter is possible thanks to it being a docker image. So far I've been using this script I built for similar purposes: https://gist.github.com/silviogutierrez/3dca60a6b5b8fe214052b45cfe7c9b63 https://gist.github.com/silviogutierrez/3dca60a6b5b8fe214052... Runs locally, and only on changed files against master. Fixes all my python, JS, yaml, terraform, etc. And you can run it against a single file too so I integrated it with vim to replace all my linters. I really hope the GitHub initiative projects takes off as a standard API (à la language server) for linters and fixers. Seems every single IDE needs to reinvent a plugin for applying a specific linter.
- zkoppert 6y agoI think there is an opportunity to integrate/add your gist to the super linter. Feel free to open an issue to get that started.
- corndoge 6y agoNo C/C++ support?
- perryizgr8 6y agoYou don't have linters for C/C++ as far as I know. I guess they could have included code-formatters too, like clang-format.
- KindOne 6y agoWhat about clang-tidy? http://clang.llvm.org/extra/clang-tidy/ http://clang.llvm.org/extra/clang-tidy/ cpplint? https://github.com/cpplint/cpplint https://github.com/cpplint/cpplint
- photonios 6y agoI used this in the past: http://cppcheck.sourceforge.net/ http://cppcheck.sourceforge.net/
- usr1106 6y agoI learned C 1986 and lint existed back then. According to Wikipedia it's from 1978. Of course C was a different languange back then. But I am rather sure modern variants exist. Clang-tidy comes to my mind, but I don't write any significant amount of C/C++ these days.
- acuozzo 6y agolint for C has existed in one form or another for 42 years. https://en.wikipedia.org/wiki/Lint_(software) https://en.wikipedia.org/wiki/Lint_(software)
- gotoeleven 6y agoI'd like to see default linter settings that scan code for problematic words like 'master' that cause harm and silence black voices.
- tlrobinson 6y agoGreat! Now do it for code formatters! After using Prettier for a few years I'm firmly in the camp of mandatory/enforced code formatters. As long as it's a half decent formatter like Prettier I believe my personal opinions on the specific formatting choices are much less important than essentially never having to think about formatting again, in particular having to ask people to fix formatting in code reviews (or fix it myself). I also love just banging out code, saving, and having my editor clean up the formatting for me.
- 6gvONxR4sf7o 6y agoSo much this. I had strong opinions on style until I found good autoformatters. Now I write horribly unformatted code and it comes out super clean and organized as soon as I hit save. Now I don’t even really care what the standard is because it only affect reading code.
- michaelmior 6y agoI agree with sentiment but I don't think it's entirely true that it only affects reading code. When it comes to modifying existing code, I have to deal with whatever format the existing code was written in. For example, personally I hate working with code with tabs so I would find this frustrating. (As an aside, I'll admit this is really my problem and a rather silly one.) Of course one solution is to transform code on read to the current user's preferred format and then back to the canonical format on commit. Although this seems potentially error prone.
- ambicapter 6y ago> When it comes to modifying existing code You don't have to deal with anything as long as you're using the same formatter everyone else is using.
- michaelmior 6y agoMy point was that when writing new code, I can write it in whatever format I want knowing that it's going to be formatted the canonical way. But when modifying code, I have to work with code in one specific format that may not be my preferred format.
- noja 6y agoCan we have something to beautify the code too? Like gofmt or shfmt?
- oefrha 6y agogolangci-lint already supports gofmt. You just need to turn it on.
- AJRF 6y agoThere seems to be a universal law of software systems that if small, self-contained subsystems exist - someone will glom them all together into an Uber-system, and vice versa. It’s inescapable.
- dbmikus 6y agoIn business they call it bundling and unbundling: > There are only two ways to make money in business: One is to bundle; the other is to unbundle. [1] [1]: https://twitter.com/eriktorenberg/status/1214671238552940544 https://twitter.com/eriktorenberg/status/1214671238552940544
- osrec 6y agoThis happened at a number of places I worked! In one case, we started with a monolith, broke it down to a service oriented architecture, realised the SOA was not scalable enough, so rebuilt the monolith. Good way to waste a couple of years!
- pmiller2 6y agoThat’s kind of the rationale behind the Unix philosophy. Every individual tool does one thing well, but, many tasks need you to do n things. So, you bodge together a few of the simple tools (analogy: simple machines from classical physics), et voilà! Now, you’ve done something bigger than the sum of its parts. Yes, this is a bit different, but, you know, having a super-linter around would be kinda handy. It gets old installing and configuring these things sometimes.
- teddyh 6y ago“You will appear to be a visionary planner if you decentralize everything which is centralized and centralize everything which is decentralized.” — Dogbert, Build a Better Life by Stealing Office Supplies (Dogbert’s Big Book of Business), Scott Adams, 1991
- chadlavi 6y agothat's fine and all, but it sounds like I'd have to do a bit of manual work to get the same exact set of linting rules locally, so that I can lint before pushing. CI linting/testing should be a final check, not a part of your iterative workflow. Any linting or testing you do in CI should have already been done locally by the dev.
- jameslk 6y agoOne step closer to Linting as a Service. That'll be next, along with Compilation/Build Systems as a Service. Or more likely part of the whole IDE moving to the cloud. The pain being solved here is that setting up the right development environment is hard, especially for those still learning to program. Many would be much more productive if we skip this step. Another prediction: Once the development environment moves to the cloud, it will be tied directly to the deployment to a specific platform, such as Azure if this is offered by GitHub. Then Amazon and Google will have to build their own IDEs in the cloud to compete. We'll no longer be developing locally but in the browser, and it will cost a lot more.
- throwaway43234 6y agoGitHub Codespaces was announced at Satellite and it's basically what you say - a way for developers to skip the "setting up" step (often the most annoying step and single biggest blocker for OSS contributions) in a new repo. https://github.com/features/codespaces https://github.com/features/codespaces Disclaimer, I helped make these :)
- jameslk 6y agoInteresting. Yes this is definitely in the direction I was thinking. I'd also say Repl.it is very similar too. Maybe they'll be acquired.
- rckoepke 6y ago> I'd also say Repl.it is very similar too. Indeed. It's interesting that GitHub Classroom uses Repl.it (and another MS web IDE) rather than Github Codespaces: https://github.blog/2020-05-26-code-in-the-browser-with-github-classroom/ https://github.blog/2020-05-26-code-in-the-browser-with-gith... https://classroom.github.com/help/online-ide-integrations https://classroom.github.com/help/online-ide-integrations Seems like a friendly ecosystem for the moment.
- oefrha 6y agoAutomated code review SaaS'es (using off-the-shelf linters, and more) have been around for what, a decade, or longer? So this is not "one step closer" to linting as a service.
- rdsubhas 6y agoWhat's very interesting in the list here: https://github.com/github/super-linter/#supported-linters https://github.com/github/super-linter/#supported-linters Java is the only major language without any sane default coding standard (no, google-java-format is google-specific, outdated, not up-to-date with recent versions and not maintained by community). It's a pity really.
- ithrow 6y agoJava is going downhill(as in not much new code is being written in it), so of the mainstream languages is going to get supported last if ever.
- StyloBill 6y ago> Java is going downhill(as in not much new code is being written in it) This is just completely false. - https://madnight.github.io/githut/#/pull_requests/2020/1 https://madnight.github.io/githut/#/pull_requests/2020/1 - https://insights.stackoverflow.com/survey/2020#technology-programming-scripting-and-markup-languages-all-respondents https://insights.stackoverflow.com/survey/2020#technology-pr... I could link many other links showing Java as an extremely widespread language. There is just nothing comparable in the corporate world.
- bluedevil2k 6y agoThis is an inane comment, there's TONS of new code being written in it, probably more than any other language. Outside the HN bubble of Rust/Draco/OCaml companies tend to stick with the Java/JS/Ruby/C# languages.
- majewsky 6y ago> there's TONS of new code being written in [Java], probably more than any other language Nah, it's a pretty safe bet that the language with the most new code being written is JavaScript. If it weren't JavaScript, I'd actually guess Excel next. (Okay, maybe not in terms of LOC, but certainly in number of applications.)
- jldugger 6y ago> The rule set for Ruby and Rails are pulled from the Ruby gem: rubocop-github and follow the same rules and versioning we use on GitHub.com. Anyone know how this compares with https://relaxed.ruby.style https://relaxed.ruby.style ? The default rubocop is very angry about meaningless shit, curious where github falls on that spectrum.
- amasad 6y agoThe trend of putting developer tools behind a unified API is just awesome. Especially great for tool makers like us at Repl.it. We're investing a lot in this area too: - UPM: universal package manager https://github.com/replit/upm https://github.com/replit/upm - Prybar: universal REPL interface for interpreters https://github.com/replit/prybar https://github.com/replit/prybar
- softwaredoug 6y agoIs anyone else uncomfortable with Github/MS owning more and more of your tool chain? Maybe my lock-in radar is faulty, but the more this happens, the more scared I get.
- lixtra 6y agoIt’s MIT License. You’re free to fork.
- kitplummer 6y agoAs if licenses mean anything. What exactly does forking by you?
- toolz 6y agothe ability to use an old working version if the maintainers make breaking changes - which will at least buy you enough time to move to something else
- softwaredoug 6y agoYeah but only MS/GH have the resources to maintain a viable project here. Little old you and me aren’t really going to reasonably fork something and have the time to maintain it.
- stu2b50 6y agoHm, I wouldn't say so for the superlinter specifically. If you actually look at the source, it doesn't seem particularly hard to maintain.
- kitplummer 6y agoI am starting to feel this way about just git.
- yjftsjthsd-h 6y ago
- hultner 6y agoWhat I'm missing is a really good linter and auto-formatter for PostgreSQL or just standard SQL. Haven't found something that seems well established and well made.
- OJFord 6y agoI was looking for one recently and was also surprised not to find anything really. I thought there'd for sure be one already packaged for `pre-commit`.
- geitir 6y agoI tried apexsql and redgate and didn't like them. I do like the built in one for datagrip, it still isn't perfect but is acceptable for me. Apexsql has a cli too I believe
- deleted 6y ago[deleted]
- kristopolous 6y agoAm I the only one that dislikes linting? Btw, you don't have to respond with the talking points I've heard all my life on why it's supposedly great, I've obviously heard them and think they're bogus. I just find it strange that I'm the only one.
- Vinnl 6y agoWhat do you dislike about bugs being highlighted as you type, rather than first having to run your code?
- kristopolous 6y agoThis is just me btw, don't take offense: Because some things are better expressed in different rules. That's why some syntax is optional in the first place, that's the reason it was made that way. The flexibility is a very intentional feature. It wasn't an accident. Maybe you want multiple spaces to vertically align code in a complex set of logic. Maybe you want to express things on multiple lines to break them up. Maybe you have deep nesting so you want to go from 4 spaces to 2. Maybe you want no braces in a single line if statement except in certain cases. This could go for pages. Poof! All gone. You can't do any of it anymore. Not following optional syntax like having a space after a comma or a space before a parenthesis is not a software bug. It's a waste of time. The compiler doesn't care and I don't either. Instead it becomes a literal Blocking Issue most of the time. So instead of working on the actual blocking issues of the code base, you spend time doing "you did this here because of some context I don't understand and I'm not allowing it" You can't commit your code without conforming to it. Also because linters are dumb. They "spot" things that are perfectly fine as supposed bugs (because they don't actually know types or logic, they're just dumb syntax checkers) and you have to work around them to satiate them with the possibility of introducing new bugs to prevent some tripwire system from false positives. Compiler writers and language designers are the only people I've found who agree with me. It's fine for protecting against profound levels of incompetence but I don't do that and you probably don't either.
- Vinnl 6y ago
- ausjke 6y agoPlease someone design a cppfmt for c++ in the modern age. If possible for C as well, to a less extent. for clang-format, it can not even add blank lines between functions, and it can not indent "public, private, protect" inside class sanely, which are two very basic needs. The rest options are worse, however, but I hope something better than clang-format.
- fergie 6y agoI feel like this is just softening us up for the inevitable vscode (online edition)
- Vinnl 6y agoSeems like this is the equivalent to GitLab's Code Quality CI template [1]? Which is supposedly built on Code Climate [2]. [1] https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html https://docs.gitlab.com/ee/user/project/merge_requests/code_... [2] https://codeclimate.com/ https://codeclimate.com/
- llbeansandrice 6y agoOh we use GitLab for work. Was wondering if there's an equivalent for that or similar.
- jamesh-gl 6y agoGitLab Product Manager here - The Codeclimate engine that out CodeQuality feature uses does support about half of the same languages as SuperLinter through plugins that can be added in the codeclimate.yml file. We are exploring how to support the missing languages and add output to the existing and future CodeQuality features. We have also seen that SuperLinter can be run as part of a GitLab pipeline without too much hassle. -James H Product Manager - Testing
- j4yav 6y agoYou can see how to do so here, if interested: https://gitlab.com/snippets/1988376 https://gitlab.com/snippets/1988376
- mikewhy 6y agoWe're in the process of stripping out Code Climate at work. Since it's difficult to run locally, the whole "let CI run to see if your code lints" isn't a great experience. And when first running prettier on our codebase, it stated something like 8 days to "fix" it. Just a poor experience all around. GitHub's approach here seems much more sane.
- mythshaker 6y agoThey don't do the same thing
- ChrisMarshallNY 6y agoI think this is great. I use SwiftLint for my code (Swift, not supported in SuperLinter, and I don't expect it to be). https://littlegreenviper.com/miscellany/swiftwater/swiftlint/ https://littlegreenviper.com/miscellany/swiftwater/swiftlint... I am real big on code quality. LINT is not a silver bullet, but every little bit helps. I also use things like -wall (or the equivalent, thereof, in Swift), and heavy-duty code commenting. https://medium.com/chrismarshallny/leaving-a-legacy-1c2ddb0c8014 https://medium.com/chrismarshallny/leaving-a-legacy-1c2ddb0c...
- tbabej 6y agoHappy to see this development! There was an earlier attempt at universal static linter by the coala project [1], however, in the recent years the project was not keeping up with the underlying tools changing [2]. It's lovely somebody's picking up the torch here! [1] https://github.com/coala/coala https://github.com/coala/coala [2] https://github.com/coala/coala/graphs/contributors https://github.com/coala/coala/graphs/contributors
- autarch 6y agoThere are already quite a few projects that do this, and IMO do it better. I did a write up of a number of them on my blog - https://blog.urth.org/2020/05/08/comparing-code-quality-meta-tools/ https://blog.urth.org/2020/05/08/comparing-code-quality-meta...
- angry_octet 6y agoAnd in the darkness combine them?
- VectorLock 6y agoReading through all these comments I see a lot of people saying "it stops the debate about style!" It seems like people are having more of an issue with bike shedding than actual code formatting.
- cool-RR 6y agoObligatory XKCD comic: https://xkcd.com/927/ https://xkcd.com/927/
- galaxyLogic 6y agoI'd like to find a formatter that aligns opening and closing braces and parentheses vertically, if they span more than one line. Is there such a formatter?
- karanrajpal 6y agoArgh I just worked on exactly this idea, as a tool for my company! What do people do when they see an idea they had/care about being implemented by someone else?
- derwiki 6y agoThis is the nature of invention -- the current climate gives multiple people the same good idea around the same time. You could abandon and join, convince the other project to do the same, keep working on yours, stop working on yours and use theirs... depends on your goals.
- avremel 6y agoDoes the linter check all or only newly pushed code? Is this configurable at all?
- zkoppert 6y agoChecks all by default but you can set an env variable in the config to only check new code.
- secondcoming 6y agoVisual Basic (6 at least) had none of these issues. It formatted your code as soon as you pressed <enter>. Im don't recall ever having control over the formatter, which was great because everyone's code ended up looking the same and there was nothing they could do about it.
- acuozzo 6y agoWhy does this post have so many commenters conflating lint & friends with code formatting tools?
- wkoszek 6y agoGitHub got a lot of fire in their ... after acquisition. I was stunned how fast GitLab overtook GitHub feature-wise, but looks like now they're at least trying to compete.
- aeyes 6y agoYou got me motivated, ONE linter for everything. Then I checked the code and see that this is a bash script which just runs the language-specific linters packaged in a Docker container :(.
- simonebrunozzi 6y agoThey should have explained what a "linter" is at the beginning of the post. [0] [0]: https://sourcelevel.io/blog/what-is-a-linter-and-why-your-team-should-use-it https://sourcelevel.io/blog/what-is-a-linter-and-why-your-te...
- zkoppert 6y agoConsidered that but thought the target audience might be familiar. I think your suggestion would have made it more accessible though to those who have not been around linters before.
- pabs3 6y agoThis kind of reminds me of check-all-the-things: https://github.com/collab-qa/check-all-the-things/ https://github.com/collab-qa/check-all-the-things/
- stevebmark 6y agoI don't understand why there's any innovation around linters. To set them up as a PR hook, you literally just run a single linter command and check the status code. Why use something like this, or the absolutely horrible tool Codeclimate? Linting is a solved problem and easy to set up, and linting rules should be a per-TEAM decision to empower teams to solve their own problems.
- zkoppert 6y agoTotally understand. I think the problem we are trying to solve here is integration with GitHub Actions as well being able to easily set up multiple linters for code ASR’s with many languages. Hope that makes sense.
- envolt 6y agoCan someone recommend a Java alternative to ESLint for JS eco-system?
- bilalhusain 6y agoUsed `checkstyle` 4 years ago to improve the quality of code. Has neat XML based rules and good IDE support. See if it fits your use-case.
- b34r 6y agoInteresting, but ultimately the best linting tool is one that runs prior to commit. Especially if it can auto-fix.
- BoDlulu 6y agoLots of comments seem to not know about SonarQube[1], which is a meta linter that has been existing for a while now. [1] https://www.sonarqube.org/ https://www.sonarqube.org/