Skip to content

Commit

Permalink
Merge pull request #158 from myii/feat/use-excludedmethods-for-ruboco…
Browse files Browse the repository at this point in the history
…p-metrics-blocklength

feat(rubocop): use org-wide standard settings for `Metrics/BlockLength`
  • Loading branch information
myii authored Apr 18, 2020
2 parents b93c58f + 39d01f1 commit 796815b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 101 deletions.
1 change: 0 additions & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ ignore: |
ssf/files/default/.yamllint
ssf/files/default/kitchen.yml
ssf/files/default/inspec/inspec.yml
ssf/files/tofs_powerdns-formula/.rubocop.yml
ssf/files/tofs_ssf-formula/.travis.yml
ssf/files/tofs_ssf-formula/.yamllint
Expand Down
10 changes: 8 additions & 2 deletions ssf/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ ssf_node_anchors:
# An alternative method could be to use:
# `git describe --abbrev=0 --tags`
# yamllint disable rule:line-length rule:quoted-strings
title: "ci(kitchen+travis+inspec): add initial platforms and test structure"
body: '* Automated using /~https://github.com/myii/ssf-formula/pull/157'
title: "chore(rubocop): use org-wide standard settings for '`'Metrics/BlockLength'`' [skip ci]"
body: '* Automated using /~https://github.com/myii/ssf-formula/pull/158'
# yamllint enable rule:line-length rule:quoted-strings
github:
owner: 'saltstack-formulas'
Expand Down Expand Up @@ -156,6 +156,12 @@ ssf_node_anchors:
Bugbear: *line_length_bugbear
Default: *line_length_default
Max: *line_length_bugbear
Metrics/BlockLength:
ExcludedMethods:
- control
- describe
Default: 25
Max: 30
salt_lint: {}
script_kitchen:
bin: 'bin/kitchen'
Expand Down
17 changes: 10 additions & 7 deletions ssf/files/default/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
# Based on /~https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
{%- endif %}
Max: {{ rbcp_LLL.Max }}
{%- set MBL = 'Metrics/BlockLength' %}
{{ MBL }}:
{%- set rbcp_MBL = rubocop.Cops.get(MBL) %}
ExcludedMethods:
{%- for method in rbcp_MBL.ExcludedMethods %}
- {{ method }}
{%- endfor %}
# Increase from default of `{{ rbcp_MBL.Default }}`
Max: {{ rbcp_MBL.Max }}

{%- if rubocop.AllCops %}

Expand All @@ -27,17 +36,11 @@ AllCops:
{%- endif %}

# Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config`
{%- if semrel_formula == 'template' %}
# <REMOVEME
{%- endif %}
{%- for cop, config in rubocop.Cops.items() if cop not in [LLL] %}
{%- for cop, config in rubocop.Cops.items() if cop not in [LLL, MBL] %}
{{ cop }}:
{#- This is purposefully simplistic for the time being,
until (if ever) more advanced configuration is necessary #}
{%- for k, v in config.items() %}
{{ k }}: {{ v }}
{%- endfor %}
{%- endfor %}
{%- if semrel_formula == 'template' %}
# REMOVEME>
{%- endif %}
44 changes: 0 additions & 44 deletions ssf/files/tofs_powerdns-formula/.rubocop.yml

This file was deleted.

47 changes: 0 additions & 47 deletions ssf/formulas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,6 @@ ssf:
- [ubuntu , 18.04, master, 3, repositories]
- [debian , 9 , 2019.2, 3, preferences]
- [ubuntu , 18.04, 2019.2, 3, unattended]
rubocop:
Cops:
Metrics/BlockLength:
Max: 55
semrel_files: *semrel_files_default
apt-cacher:
context:
Expand Down Expand Up @@ -656,10 +652,6 @@ ssf:
- [centos , 7 , 2019.2, 3, default]
- [centos , 6 , 2018.3, 2, default]
# - [arch-base , latest, 2018.3, 2, default]
rubocop:
Cops:
Metrics/BlockLength:
Max: 250
semrel_files: *semrel_files_default
django:
context:
Expand Down Expand Up @@ -795,10 +787,6 @@ ssf:
- [opensuse/leap, 15.1 , 2018.3, 2, default]
- [arch-base , latest, 2018.3, 2, default]
# - [ubuntu , 16.04, 2017.7, 2, default]
rubocop:
Cops:
Metrics/BlockLength:
Max: 39
semrel_files: *semrel_files_default
golang:
context:
Expand Down Expand Up @@ -1558,10 +1546,6 @@ ssf:
# Not configured at all for `arch-base`
# https://wiki.archlinux.org/index.php/OpenLDAP
# # - [arch-base , latest, 2018.3, 2, default]
rubocop:
Cops:
Metrics/BlockLength:
Max: 30
semrel_files: *semrel_files_default
openssh:
context:
Expand Down Expand Up @@ -1620,10 +1604,6 @@ ssf:
- [centos , 7 , 2018.3, 2, default]
- [opensuse/leap, 15.1 , 2018.3, 2, default]
- [centos , 6 , 2017.7, 2, default]
rubocop:
Cops:
Metrics/BlockLength:
Max: 36
yamllint:
ignore:
additional:
Expand Down Expand Up @@ -1889,12 +1869,6 @@ ssf:
# - [amazonlinux , 2 , 3000.1, 3, default]
- [fedora , 31 , 2019.2, 3, default]
# - [arch-base , latest, 2018.3, 2, default]
rubocop:
Cops:
Metrics/BlockLength:
ExcludedMethods:
- control
- describe
yamllint:
ignore:
additional:
Expand Down Expand Up @@ -2224,7 +2198,6 @@ ssf:
- ssf/files/default/.yamllint
- ssf/files/default/kitchen.yml
- ssf/files/default/inspec/inspec.yml
- ssf/files/tofs_powerdns-formula/.rubocop.yml
- ssf/files/tofs_ssf-formula/.travis.yml
- ssf/files/tofs_ssf-formula/.yamllint
rules:
Expand Down Expand Up @@ -2284,10 +2257,6 @@ ssf:
inspec_yml:
summary: >-
Verify that the strongswan formula is setup and configured correctly
rubocop:
Cops:
Metrics/BlockLength:
Max: 27
use_tofs: true
semrel_files: *semrel_files_default
stunnel:
Expand Down Expand Up @@ -2340,10 +2309,6 @@ ssf:
- '*':
- .
- .included
rubocop:
Cops:
Metrics/BlockLength:
Max: 41
semrel_files: *semrel_files_default
sysctl:
context:
Expand Down Expand Up @@ -2457,10 +2422,6 @@ ssf:
# - [amazonlinux , 1 , 2017.7, 2]
- [arch-base , latest, 2017.7, 2]
platforms_matrix: *platforms_matrix_systemd_only
rubocop:
Cops:
Metrics/BlockLength:
Max: 41
use_tofs: true
semrel_files: *semrel_files_default
telegraf:
Expand Down Expand Up @@ -2537,10 +2498,6 @@ ssf:
- [fedora , 31 , 2019.2, 3, default]
- [arch-base , latest, 2019.2, 2, default]
- [centos , 6 , 2018.3, 2, centos6]
rubocop:
Cops:
Metrics/BlockLength:
Max: 36
use_libsaltcli: true
use_tofs: true
semrel_files:
Expand Down Expand Up @@ -2883,10 +2840,6 @@ ssf:
- [ubuntu , 16.04, 2019.2, 3, default]
- [debian , 8 , 2018.3, 2, default]
# - [fedora , 30 , 2018.3, 3, default]
rubocop:
Cops:
Metrics/BlockLength:
Max: 28
use_tofs: true
yamllint:
rules:
Expand Down

0 comments on commit 796815b

Please sign in to comment.