Merge pull request #169 from dev-sec/newlint

Change linting to Cookstyle
This commit is contained in:
schurzi 2022-03-18 20:44:54 +01:00 committed by GitHub
commit 07929ea2d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 37 deletions

View file

@ -2,31 +2,3 @@
AllCops: AllCops:
Exclude: Exclude:
- vendor/**/* - vendor/**/*
Documentation:
Enabled: false
ParameterAlignment:
Enabled: true
HashSyntax:
Enabled: true
LineLength:
Enabled: false
EmptyLinesAroundBlockBody:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
MethodLength:
Max: 40
NumericLiterals:
MinDigits: 10
Metrics/BlockLength:
Max: 35
Metrics/CyclomaticComplexity:
Max: 10
Metrics/PerceivedComplexity:
Max: 10
Metrics/AbcSize:
Max: 30
# Lint/AmbiguousBlockAssociation is incompatible with RSpec
# https://github.com/rubocop-hq/rubocop/issues/4222
Lint/AmbiguousBlockAssociation:
Enabled: false

View file

@ -2,6 +2,7 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'cookstyle'
gem 'highline' gem 'highline'
gem 'rack' gem 'rack'
gem 'rake' gem 'rake'

View file

@ -1,5 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'cookstyle'
require 'rake/testtask' require 'rake/testtask'
require 'rubocop/rake_task' require 'rubocop/rake_task'
@ -9,6 +10,10 @@ task :rubocop do
RuboCop::RakeTask.new RuboCop::RakeTask.new
end end
RuboCop::RakeTask.new(:cookstyle) do |task|
task.options << '--display-cop-names'
end
# lint the project # lint the project
desc 'Run robocop linter' desc 'Run robocop linter'
task lint: [:rubocop] task lint: [:rubocop]

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
# #
# Copyright 2015, Patrick Muench # Copyright:: 2015, Patrick Muench
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -29,8 +29,8 @@ shadow_group = 'root'
shadow_group = 'shadow' if os.debian? || os.suse? || os.name == 'alpine' shadow_group = 'shadow' if os.debian? || os.suse? || os.name == 'alpine'
container_execution = begin container_execution = begin
virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/ virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/
rescue NoMethodError rescue NoMethodError
false false
end end
blacklist = input( blacklist = input(

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
# #
# Copyright 2015, Patrick Muench # Copyright:: 2015, Patrick Muench
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -21,8 +21,8 @@
container_execution = begin container_execution = begin
virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/ virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/
rescue NoMethodError rescue NoMethodError
false false
end end
control 'package-01' do control 'package-01' do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
# #
# Copyright 2015, Patrick Muench # Copyright:: 2015, Patrick Muench
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -23,8 +23,8 @@ sysctl_forwarding = input('sysctl_forwarding', value: false, description: 'Is ne
kernel_modules_disabled = input('kernel_modules_disabled', value: 0, description: 'Should loading of kernel modules be disabled?') kernel_modules_disabled = input('kernel_modules_disabled', value: 0, description: 'Should loading of kernel modules be disabled?')
container_execution = begin container_execution = begin
virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/ virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/
rescue NoMethodError rescue NoMethodError
false false
end end
control 'sysctl-01' do control 'sysctl-01' do