6 ms·
The developers in the team do not change linting rules as they want. But I am not referring at small stuff, recent things for last weeks(maybe VS code does this
by simion314 6y ago
The developers in the team do not change linting rules as they want. But I am not referring at small stuff, recent things for last weeks(maybe VS code does this by default or maybe you need 12 extra extensions that makes things much slower, let me know)
- I go to fix some issue and my IDE shows me that the code is copy-pasted in 3 places so I knew I have to extract a function, do some cleanup and fix all 3 affected places.
- bug appeared other a refactor, checking the code in the IDE I can see a red variable name, it was red because it was undefined(this is in JS code)
- sometimes when using soem inner function I would try to do something like "this.something" but the IDE notices it and warns me that in this scope "this" is soemthing else
I am also impressed that it can most of the time understands frameworks and libraries like angular or jQuery
- machiaweliczny 6y agoNone od those would pass CI
- simion314 6y agoReally? Are CI tools parsing the code and will detect that this.something is not defined here? I am presently surprised so let me know what tool does this.
- blittle 6y agoThe same tool that your IDE is using underneath the hood
- simion314 6y agoDo you know more? I am assuming the IDE has only one AST and uses custom tools and not running 10 different tools in background but my assumption could be wrong.
- pirocks 6y agoFor IntelliJ-based IDEs this is broadly correct, though some languages may occasionally call out to third party tools.
- aszen 6y agoMost cli tools can be easily integrated with continuous integration platforms like GitHub actions / Travis CI. See static analysis tools and code quality one's, in php these are Psalm, php-stan, php code sniffer and others. For JavaScript see ESLint with recommended rules from different companies, typescript with allow js turned on to analyse javascript code and other tools for statically checking css, html and more.
- deleted 6y ago[deleted]
- adrian17 6y agoCI won't notify you the same second you finished writing the expression.
- wwright 6y agoSetting up eslint or related tools in a CI pipeline would let you catch these in an enforceable, consistent, decoupled way. Of course, it sounds like there is no real testing or review before your team commits to master anyway, so there is your low-hanging fruit.
- simion314 6y agoIt is an old project, setting up a strict automated CI would just block us until we fix all warnings or disable them. With a good IDE you can spot the issue int the location you work, you say change most of the "var" to "let" and "const" but you can ignore the ones that are not related with the thing you are working on. With an automated thing you either fix all at once or you have to set ignore rules or write ignore statements int he code. I would be interested to read more on how to add such a strict CI to an existing project.
- nicoburns 6y agoI'm sure you could get the linting tool to run only on changed files (we have a pre-commit git hook that does this at work, although we have CI set up to run against the whole codebase). To be honest though, I think the best approach would to pick a few of the rules you consider to be the most important and just be suck it up and spend a couple of days fixing all the errors. It likely wouldn't take you long to make that time back.
- simion314 6y agoAgreed, but for sure having a CI with parts of the rule won't be as good as having that and on top an IDE that has all the rules On and even more you can see the warning as you type not after you committed and submitted a PR.
- nicoburns 6y agoWell sure, but text editors like VS Code and Sublime can do this too. You usually need to install a plugin but everybody I know who uses these editors installs the relevant plugins for the languages they use. VS Code is particularly smart in that will pull in TypeScript definitions for libraries and use those for auto-completion even if you are not using TypeScript (and are using plain JavaScript).