Skip to content

Commit 2c25931

Browse files
authored
Merge pull request #203 from dev-sec/newlint
Change linting to Cookstyle
2 parents e3c4b5e + ce6aa1e commit 2c25931

6 files changed

Lines changed: 18 additions & 40 deletions

File tree

.rubocop.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,3 @@
22
AllCops:
33
Exclude:
44
- vendor/**/*
5-
Documentation:
6-
Enabled: false
7-
Layout/ParameterAlignment:
8-
Enabled: true
9-
HashSyntax:
10-
Enabled: true
11-
LineLength:
12-
Enabled: false
13-
EmptyLinesAroundBlockBody:
14-
Enabled: false
15-
Style/Encoding:
16-
Enabled: false
17-
MethodLength:
18-
Max: 40
19-
NumericLiterals:
20-
MinDigits: 10
21-
Metrics/BlockLength:
22-
Max: 35
23-
Metrics/CyclomaticComplexity:
24-
Max: 10
25-
Metrics/PerceivedComplexity:
26-
Max: 10
27-
Metrics/AbcSize:
28-
Max: 30
29-
# Lint/AmbiguousBlockAssociation is incompatible with RSpec
30-
# https://github.com/rubocop-hq/rubocop/issues/4222
31-
Lint/AmbiguousBlockAssociation:
32-
Enabled: false

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
source 'https://rubygems.org'
44

5+
gem 'cookstyle'
56
gem 'highline'
67
gem 'rack'
78
gem 'rake'

Rakefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# frozen_string_literal: true
22

3+
require 'cookstyle'
34
require 'rake/testtask'
45
require 'rubocop/rake_task'
56

@@ -9,6 +10,10 @@ task :rubocop do
910
RuboCop::RakeTask.new
1011
end
1112

13+
RuboCop::RakeTask.new(:cookstyle) do |task|
14+
task.options << '--display-cop-names'
15+
end
16+
1217
# lint the project
1318
desc 'Run robocop linter'
1419
task lint: [:rubocop]

controls/ssh_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright 2015, Patrick Muench
3+
# Copyright:: 2015, Patrick Muench
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

controls/sshd_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright 2015, Patrick Muench
3+
# Copyright:: 2015, Patrick Muench
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

libraries/ssh_crypto.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright 2015, Dominik Richter
3+
# Copyright:: 2015, Dominik Richter
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -18,14 +18,14 @@
1818
# author: Dominik Richter
1919
# author: Patrick Muench
2020

21-
class SshCrypto < Inspec.resource(1) # rubocop:disable Metrics/ClassLength
21+
class SshCrypto < Inspec.resource(1)
2222
name 'ssh_crypto'
2323

2424
def ssh_version
2525
inspec.command('ssh -V 2>&1 | cut -f1 -d" " | cut -f2 -d"_"').stdout.to_f
2626
end
2727

28-
def valid_ciphers # rubocop:disable Metrics/CyclomaticComplexity
28+
def valid_ciphers
2929
# define a set of default ciphers
3030
ciphers53 = 'aes256-ctr,aes192-ctr,aes128-ctr'
3131
ciphers66 = 'chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr'
@@ -70,7 +70,7 @@ def valid_ciphers # rubocop:disable Metrics/CyclomaticComplexity
7070
ciphers
7171
end
7272

73-
def valid_kexs # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
73+
def valid_kexs
7474
# define a set of default KEXs
7575
kex85 = 'sntrup761x25519-sha512@openssh.com,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256'
7676
kex80 = 'sntrup4591761x25519-sha512@tinyssh.org,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256'
@@ -131,7 +131,7 @@ def valid_kexs # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize,
131131
kex
132132
end
133133

134-
def valid_macs # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/AbcSize
134+
def valid_macs
135135
# define a set of default MACs
136136
macs66 = 'hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256'
137137
macs59 = 'hmac-sha2-512,hmac-sha2-256,hmac-ripemd160'
@@ -185,7 +185,7 @@ def valid_macs # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLen
185185
macs
186186
end
187187

188-
def valid_privseparation # rubocop:disable Metrics/CyclomaticComplexity
188+
def valid_privseparation
189189
# define privilege separation set
190190
ps53 = 'yes'
191191
ps59 = 'sandbox'
@@ -226,10 +226,10 @@ def valid_privseparation # rubocop:disable Metrics/CyclomaticComplexity
226226
end
227227

228228
# return a list of valid algoriths for a current platform
229-
def valid_algorithms # rubocop:disable Metrics/CyclomaticComplexity
230-
alg53 = %w[rsa]
231-
alg60 = %w[rsa ecdsa]
232-
alg66 = %w[rsa ecdsa ed25519]
229+
def valid_algorithms
230+
alg53 = %w(rsa)
231+
alg60 = %w(rsa ecdsa)
232+
alg66 = %w(rsa ecdsa ed25519)
233233
alg = alg66 # probably its a best suitable set for everything unknown
234234

235235
case inspec.os[:name]

0 commit comments

Comments
 (0)