19 Commits

Author SHA1 Message Date
Isabell Long
5cbb414797 formula_desc_cop: Fix the 'full stop at end of description' autocorrect
- It wasn't working because desc strings end in quotes, not just full
  stops.
2017-11-01 19:50:56 +00:00
Isabell Long
0786d41693 formula_desc_cop: If desc ends with 'etc.', it's not a violation 2017-11-01 19:50:56 +00:00
Isabell Long
640b1e9dcb formula_desc_cop: ensure no full stops at the end of desc
- This was a suggestion by Mike McQuaid in my `homebrew-core` audit
  description PR. Based on ilovezfs's incantation `grep -r -E 'desc
  ".*\."' *.rb`, some formulae descriptions do end in full stops. (My
  initial assessment of this failed to account for the fact that
  descriptions are strings and so end in `"`.)
- Add an autocorrect for this cop, too.
2017-10-29 15:19:31 +00:00
Markus Reiter
7e970216a3 Refactor and fix RuboCop specs. 2017-10-24 19:39:40 +02:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
Dominyk Tiller
075f818118
formula_desc_cop: empty string is not a valid desc
Just a slightly tweaked version of https://github.com/Homebrew/brew/issues/3286#issuecomment-334983011
2017-10-14 02:48:55 +01:00
JCount
68878d73ef formula_desc_cop: add 'x86' to VALID_LOWERCASE_WORDS 2017-08-01 11:36:44 -04:00
ilovezfs
7013f9dee3 formula_desc_cop: allow formula name in desc
except at the very beginning, as the audit originally intended.

See https://github.com/Homebrew/legacy-homebrew/pull/45493.
2017-06-29 08:14:58 -07:00
Andrew Janke
b5a0cfd861 rubocops: use consistent (_)body_node parameter name 2017-06-19 23:37:32 -04:00
Isabell Long
b2f2fbfa63 format_desc_cop: whitelist more lowercase words
- From `homebrew-core` PR 14229, we decided to whitelist more words so
  that reordering to appease "description must start with a capital
  letter" wasn't so clunky.
2017-06-13 12:37:22 +01:00
Mike McQuaid
c572081f8b formula_desc_cop: tweak some rules.
Allow some specific lowercase words and provide an autocorrect for some
of these rules.
2017-06-08 15:13:10 +03:00
Mike McQuaid
82b113cdd0 formula_desc_cop: desc should be capitalised.
Note that the formula description field should start with a capital
letter.
2017-06-02 22:25:07 +01:00
Isabell Long
279a4df6c3 Match the "formula name in description" on word boundaries
- The regexp for the "check if formula name is used in formula's
  description" cop matches every instance of the formula name if it
  exists, whether it's in a word or not.
- For example, the formula `mon` has the description "Monitor
  hosts/services/whatever and alert about problems". This makes
  `brew audit --strict` complain because it matches "Monitor",
  which isn't the formula name! The formula `pass` has the description
  "Password manager".  Again, the strict audit matches "Password",
  which isn't an issue.
- Instead, this change matches on a word boundary, so it will match
  `mon:`, or `mon `, but not "Monitor", or, for example, "harmony".
- I've changed the tests to account for this change.
2017-05-29 00:26:47 +01:00
Gautham Goli
fed668b330 Add --only-cops,--except-cops options for brew style and simplify cop names 2017-05-03 14:49:23 +05:30
Gautham Goli
c3330c289d Add --only-cops,--except-cops options for brew audit
Also refactor audit cops into two "departments"
 - FormulaAudit
 - FormulaAuditStrict
2017-05-02 23:26:12 +05:30
Gautham Goli
a693ca332e Wrap rubocop specific code into methods inside FormulaCop 2017-03-26 15:26:41 +05:30
Gautham Goli
febc108598 Encapsulate formula desc offense checking logic into methods 2017-03-26 15:26:41 +05:30
Gautham Goli
d32978b859 Create FormulaCop base class to reuse helper functions in custom cops 2017-03-08 11:44:35 +05:30
Gautham Goli
19f693d25b Port audit_desc rules to cop 2017-03-02 12:50:05 +05:30