Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Linting Legacy Code

Ivan Tse
July 14, 2015
110

Linting Legacy Code

Linters are great tools that help to prevent accidental bugs, automate code reviews, and enforce a style guide. But even with all the benefits, linters are still not as widely adopted as they should be. For legacy codebases, a gigantic patch will be needed to fix existing warnings. One approach to mitigate some of these concerns is to introduce linting incrementally. I will talk about adding lint rules one at a time, linting on new changes only, and reporting warnings unobtrusively.

Ivan Tse

July 14, 2015
Tweet

Transcript

  1. LINTING LEGACY CODE INTEGRATING LINTERS INTO OUR WORKFLOW Ivan Tse,

    Paperless Post Twitter: @ivan_tse GitHub: @ivantsepp
  2. “Programs are meant to be read by humans and only

    incidentally for computers to execute.” — H. Abelson and G. Sussman
  3. “Any styleguide will become more valuable as more of its

    enforcement becomes more automated.” http://davidtheclark.com/scss-lint-styleguide/
  4. AVAILABLE LINTERS: Ruby: Rubocop (there are rules for Rails and

    even Rspec) Haml: haml-lint Scss: Scss-lint Javascript: JSLint, JSHint, ESLint React: ESLint-plugin-React Chef: Foodcritic
  5. HOUND Hound comments on style violations in GitHub pull requests,

    allowing you and your team to better review and maintain a clean codebase.
  6. CODE CLIMATE The Code Climate Platform is the first open,

    extensible platform for all types of static analysis.
  7. Run the linter on the file before and after the

    changes. Report any new warnings