You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a Linter
So many problems can be solved by using a code linter. For anyone who’s unfamiliar with linters, a code linter reads your code and outputs errors and warnings if your code is not compliant with the specifications and standards of a language. These warnings may seem insignificant at the time, but, like the lint in your house, they add up over time. To get the most out of using a linter, I would suggest the following tricks:
Enforce the Language or Framework Standard
I highly recommend running a linter on your code to enforce the most widely accepted set of standards for the language or framework you’re working in. For example, if you’re writing Python, I would suggest you use the pylint package, which enforces rules defined in PEP-8. If you’re writing an Angular app, I would suggest using a linter configuration that follows the Angular style guide.
Integrate Your Linter With CI
A linter really isn’t going to help you at all unless you’re using it regularly, and from my experience, developers don’t typically do this unless they’re forced to. It only takes minutes to learn how to use a linter properly, so why do so many developers neglect to do so? I think it’s because we as developers are often overconfident in our code and we hate adding additional steps to our development process.
For this reason, I suggest you set up a continuous integration build pipeline with a service like Atlassian’s Bamboo, Jenkins, or Travis CI. In your build pipeline, you should make linting the first step. That way, if your code doesn’t pass the lint test, it doesn’t get built, tested, or published.
Using a linter is all about making it as hard as possible for you to write crappy code.
So many problems can be solved by using a code linter. For anyone who’s unfamiliar with linters, a code linter reads your code and outputs errors and warnings if your code is not compliant with the specifications and standards of a language. These warnings may seem insignificant at the time, but, like the lint in your house, they add up over time. To get the most out of using a linter, I would suggest the following tricks:
Enforce the Language or Framework Standard
I highly recommend running a linter on your code to enforce the most widely accepted set of standards for the language or framework you’re working in. For example, if you’re writing Python, I would suggest you use the pylint package, which enforces rules defined in PEP-8. If you’re writing an Angular app, I would suggest using a linter configuration that follows the Angular style guide.
Integrate Your Linter With CI
A linter really isn’t going to help you at all unless you’re using it regularly, and from my experience, developers don’t typically do this unless they’re forced to. It only takes minutes to learn how to use a linter properly, so why do so many developers neglect to do so? I think it’s because we as developers are often overconfident in our code and we hate adding additional steps to our development process.
For this reason, I suggest you set up a continuous integration build pipeline with a service like Atlassian’s Bamboo, Jenkins, or Travis CI. In your build pipeline, you should make linting the first step. That way, if your code doesn’t pass the lint test, it doesn’t get built, tested, or published.
Using a linter is all about making it as hard as possible for you to write crappy code.
https://github.com/embeddedartistry/jenkins-pipeline-lib/issues/new
The text was updated successfully, but these errors were encountered: