Skip to content

Commit

Permalink
feat(rubocop): include for this repo
Browse files Browse the repository at this point in the history
  • Loading branch information
myii committed Oct 10, 2019
1 parent 1d9636e commit f4fc3c1
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ignore: |
test/**/states/**/*.sls
.kitchen/
ssf/files/default/.cirrus.yml
ssf/files/default/.rubocop.yml
ssf/files/default/.travis.yml
ssf/files/default/.yamllint
ssf/files/default/kitchen.yml
Expand Down
1 change: 1 addition & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ ssf:
- inspec/README.md
- .gitignore
- .cirrus.yml
- .rubocop.yml
- .salt-lint
- .travis.yml
- .yamllint
Expand Down
1 change: 1 addition & 0 deletions ssf/config/formulas.sls
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ prepare-git-branch-for-{{ formula }}:
platforms: {{ context.platforms | yaml }}
platforms_matrix: {{ context.platforms_matrix | yaml }}
platforms_matrix_commented_includes: {{ context.platforms_matrix_commented_includes | yaml }}
rubocop: {{ context.rubocop | yaml }}
salt_lint: {{ context.salt_lint | yaml }}
script_kitchen: {{ context.script_kitchen | yaml }}
suite: {{ suite | yaml }}
Expand Down
7 changes: 7 additions & 0 deletions ssf/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ ssf_node_anchors:
# To deal with excessive instances when mimicking `kitchen list -b`
# If values are set, only use these as commented entries in the matrix
platforms_matrix_commented_includes: []
rubocop:
AllCops: {}
Cops:
Metrics/LineLength:
Bugbear: *line_length_bugbear
Default: *line_length_default
Max: *line_length_bugbear
salt_lint: {}
script_kitchen:
bin: bin/kitchen
Expand Down
37 changes: 37 additions & 0 deletions ssf/files/default/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
# General overrides used across formulas in the org
{%- set MLL = 'Metrics/LineLength' %}
{{ MLL }}:
{%- set rbcp_MLL = rubocop.Cops.get(MLL) %}
{%- if rbcp_MLL.Max == rbcp_MLL.Bugbear %}
# Increase from default of `{{ rbcp_MLL.Default }}`
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
{%- endif %}
Max: {{ rbcp_MLL.Max }}

{%- if rubocop.AllCops %}

# General settings across all cops in this formula
AllCops:
{#- This is purposefully simplistic for the time being,
until (if ever) more advanced configuration is necessary #}
{%- if rubocop.AllCops.Exclude %}
# Files to ignore completely
Exclude:
{%- for path in rubocop.AllCops.Exclude %}
- {{ path }}
{%- endfor %}
{%- endif %}
{%- endif %}

# Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config`
{%- for cop, config in rubocop.Cops.items() if cop not in [MLL] %}
{{ 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 %}
5 changes: 5 additions & 0 deletions ssf/formulas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ ssf_node_anchors:
.cirrus.yml: &file__--cirrus--yml
<<: *file_default
template: jinja
.rubocop.yml: &file__--rubocop--yml
<<: *file_default
template: jinja
.salt-lint: &file__--salt-lint
<<: *file_default
template: jinja
Expand Down Expand Up @@ -1259,6 +1262,7 @@ ssf:
ignore:
additional:
- ssf/files/default/.cirrus.yml
- ssf/files/default/.rubocop.yml
- ssf/files/default/.salt-lint
- ssf/files/default/.travis.yml
- ssf/files/default/.yamllint
Expand All @@ -1278,6 +1282,7 @@ ssf:
docs/TOFS_pattern.rst: *file__docs__TOFS_pattern--rst
formula/libtofs.jinja: *file__formula__libtofs--jinja
.gitignore: *file__--gitignore
.rubocop.yml: *file__--rubocop--yml
.salt-lint: *file__--salt-lint
.travis.yml: *file__--travis--yml
.yamllint: *file__--yamllint
Expand Down

0 comments on commit f4fc3c1

Please sign in to comment.