mudguard 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 456ae028fad5fdfd5e2e96158d53956c7a709823d2477c351050fb220e8ab1ec
4
- data.tar.gz: 0c9375de37dd75a71f89203c2248aad4cf4b555ef5f63d8ecb4442d63fe1a56f
3
+ metadata.gz: a871581e7e7227dcc8c20bc00a925eb3b71bd23f76f1e30f76267fe9bbe97503
4
+ data.tar.gz: 2dec890800cb5661fc6930429d70171c5b29a8e4c888ad6f030d668bb8f0644e
5
5
  SHA512:
6
- metadata.gz: 15a30108d5b47a12905075ed35c62ace335fd4b9303b4da46301af6db2f6b5d509d4cba95e245a4144368accf710f85e4be334c9d09a50840bad4600962078d3
7
- data.tar.gz: 6102ca6a925655ccae7d345ed4522ac8cf546f3d3fd212bedd519c1a69be3321c80a09e46b8aa1893ff67f62d9ce9703672d255dfc5ff0a22c14278dd4b7853d
6
+ metadata.gz: 1fd2e9ee1f41f0f3d033ba1015a12b715377366876d835003a4b0dd0e5743cd1728d1a6f739812cabb2017b882e2fda33aeec5dde443e79fcfe65f980ff08fda
7
+ data.tar.gz: 62c6548a4c2b3a3e1bed074be382b3e73b89f60aaa3968217c56d33e4fdc03238a482955697609664055c630c6aa46c634e022f44747123c306ab5f0a5bb31bd
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.5']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rspec --format RSpec::Github::Formatter
data/.gitignore CHANGED
@@ -4,6 +4,9 @@
4
4
  # or operating system, you probably want to add a global ignore instead:
5
5
  # git config --global core.excludesfile '~/.gitignore_global'
6
6
 
7
+ # Ignore RubyMine
8
+ /.idea
9
+
7
10
  # Ignore bundler config.
8
11
  /.bundle
9
12
 
data/.rubocop.yml CHANGED
@@ -19,7 +19,7 @@ Style/Documentation:
19
19
  - 'spec/**/*.rb'
20
20
 
21
21
  Style/HashEachMethods:
22
- Enabled: true
22
+ Enabled: true
23
23
 
24
24
  Style/HashTransformKeys:
25
25
  Enabled: true
@@ -30,3 +30,8 @@ Style/HashTransformValues:
30
30
  Layout/LineLength:
31
31
  Description: 'Limit lines to 100 characters.'
32
32
  Max: 100
33
+
34
+
35
+ Lint/EmptyFile:
36
+ Exclude:
37
+ - 'spec/lib/infrastructure/persistence/project_repository_project/**/*.rb'
data/Gemfile.lock CHANGED
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mudguard (0.2.4)
4
+ mudguard (0.2.5)
5
5
  parser (~> 2.7)
6
6
  rake (~> 13.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- ast (2.4.0)
11
+ ast (2.4.2)
12
12
  byebug (11.1.3)
13
- coderay (1.1.2)
14
- diff-lcs (1.3)
15
- ffi (1.12.2)
13
+ coderay (1.1.3)
14
+ diff-lcs (1.4.4)
15
+ ffi (1.15.0)
16
16
  formatador (0.2.5)
17
17
  guard (2.16.2)
18
18
  formatador (>= 0.2.4)
@@ -28,61 +28,65 @@ GEM
28
28
  guard (~> 2.1)
29
29
  guard-compat (~> 1.1)
30
30
  rspec (>= 2.99.0, < 4.0)
31
- listen (3.2.1)
31
+ listen (3.5.1)
32
32
  rb-fsevent (~> 0.10, >= 0.10.3)
33
33
  rb-inotify (~> 0.9, >= 0.9.10)
34
- lumberjack (1.2.5)
34
+ lumberjack (1.2.8)
35
35
  method_source (1.0.0)
36
36
  nenv (0.3.0)
37
37
  notiffany (0.1.3)
38
38
  nenv (~> 0.1)
39
39
  shellany (~> 0.0)
40
- parallel (1.19.1)
41
- parser (2.7.1.3)
42
- ast (~> 2.4.0)
43
- pry (0.13.1)
40
+ parallel (1.20.1)
41
+ parser (2.7.2.0)
42
+ ast (~> 2.4.1)
43
+ pry (0.14.1)
44
44
  coderay (~> 1.1)
45
45
  method_source (~> 1.0)
46
- pry-byebug (3.9.0)
46
+ pry-byebug (3.8.0)
47
47
  byebug (~> 11.0)
48
- pry (~> 0.13.0)
48
+ pry (~> 0.10)
49
49
  pry-doc (1.1.0)
50
50
  pry (~> 0.11)
51
51
  yard (~> 0.9.11)
52
52
  rainbow (3.0.0)
53
- rake (13.0.1)
53
+ rake (13.0.3)
54
54
  rb-fsevent (0.10.4)
55
55
  rb-inotify (0.10.1)
56
56
  ffi (~> 1.0)
57
- rexml (3.2.4)
58
- rspec (3.9.0)
59
- rspec-core (~> 3.9.0)
60
- rspec-expectations (~> 3.9.0)
61
- rspec-mocks (~> 3.9.0)
62
- rspec-core (3.9.2)
63
- rspec-support (~> 3.9.3)
64
- rspec-expectations (3.9.2)
57
+ regexp_parser (2.1.1)
58
+ rexml (3.2.5)
59
+ rspec (3.10.0)
60
+ rspec-core (~> 3.10.0)
61
+ rspec-expectations (~> 3.10.0)
62
+ rspec-mocks (~> 3.10.0)
63
+ rspec-core (3.10.1)
64
+ rspec-support (~> 3.10.0)
65
+ rspec-expectations (3.10.1)
65
66
  diff-lcs (>= 1.2.0, < 2.0)
66
- rspec-support (~> 3.9.0)
67
- rspec-mocks (3.9.1)
67
+ rspec-support (~> 3.10.0)
68
+ rspec-github (2.3.1)
69
+ rspec-core (~> 3.0)
70
+ rspec-mocks (3.10.2)
68
71
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.9.0)
70
- rspec-support (3.9.3)
71
- rubocop (0.84.0)
72
+ rspec-support (~> 3.10.0)
73
+ rspec-support (3.10.2)
74
+ rubocop (0.93.1)
72
75
  parallel (~> 1.10)
73
- parser (>= 2.7.0.1)
76
+ parser (>= 2.7.1.5)
74
77
  rainbow (>= 2.2.2, < 4.0)
78
+ regexp_parser (>= 1.8)
75
79
  rexml
76
- rubocop-ast (>= 0.0.3)
80
+ rubocop-ast (>= 0.6.0)
77
81
  ruby-progressbar (~> 1.7)
78
82
  unicode-display_width (>= 1.4.0, < 2.0)
79
- rubocop-ast (0.0.3)
80
- parser (>= 2.7.0.1)
81
- ruby-progressbar (1.10.1)
83
+ rubocop-ast (1.4.1)
84
+ parser (>= 2.7.1.5)
85
+ ruby-progressbar (1.11.0)
82
86
  shellany (0.0.1)
83
- thor (1.0.1)
87
+ thor (1.1.0)
84
88
  unicode-display_width (1.7.0)
85
- yard (0.9.25)
89
+ yard (0.9.26)
86
90
 
87
91
  PLATFORMS
88
92
  ruby
@@ -97,6 +101,7 @@ DEPENDENCIES
97
101
  pry-doc (~> 1.0)
98
102
  rake (~> 13.0)
99
103
  rspec (~> 3.9)
104
+ rspec-github
100
105
  rubocop (~> 0.80)
101
106
 
102
107
  BUNDLED WITH
data/Guardfile CHANGED
@@ -12,5 +12,5 @@ guard "rspec", rspec_options do
12
12
  watch(%r{^lib/mudguard/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
13
13
  watch(%r{^lib/mudguard/(.+)\.rb$}) { |m| Dir.glob("spec/lib/#{m[1]}_*.rb") }
14
14
  watch("spec/spec_helper.rb") { "spec" }
15
- watch(%r{^exe\/mudguard$}) { |_| "spec/exe/mudguard_spec.rb" }
15
+ watch(%r{^exe/mudguard$}) { |_| "spec/exe/mudguard_spec.rb" }
16
16
  end
@@ -7,14 +7,7 @@ module Mudguard
7
7
  # Knows all constants of the project
8
8
  class Consts
9
9
  def initialize(sources:)
10
- @consts = sources.flat_map(&:find_consts)
11
- .each_with_object({}) do |c, a|
12
- path = split_hierarchy(c)
13
- const_name = path.last
14
- module_names = path.take(path.count - 1)
15
- sub_module = module_names.reduce(a) { |h, m| h.key?(m) ? h[m] : h[m] = {} }
16
- sub_module[const_name] = {} unless sub_module.key?(const_name)
17
- end
10
+ @consts = sources.flat_map(&:find_consts).each_with_object({}, &method(:add_const))
18
11
  end
19
12
 
20
13
  def resolve(module_name, const_name)
@@ -34,6 +27,14 @@ module Mudguard
34
27
 
35
28
  private
36
29
 
30
+ def add_const(const, all_consts)
31
+ path = split_hierarchy(const)
32
+ const_name = path.last
33
+ module_names = path.take(path.count - 1)
34
+ sub_module = module_names.reduce(all_consts) { |h, m| h.key?(m) ? h[m] : h[m] = {} }
35
+ sub_module[const_name] = {} unless sub_module.key?(const_name)
36
+ end
37
+
37
38
  SEPARATOR = "::"
38
39
 
39
40
  def find_const_deeper(current_module, remaining_modules, consts, const_path)
@@ -6,7 +6,7 @@ module Mudguard
6
6
  class Dependency
7
7
  attr_reader :location, :dependency
8
8
 
9
- def initialize(location: nil, dependency:)
9
+ def initialize(dependency:, location: nil)
10
10
  @location = location
11
11
  @dependency = dependency
12
12
  end
@@ -13,16 +13,24 @@ module Mudguard
13
13
  def load_source_policies(project_path)
14
14
  file = PolicyFile.read(project_path)
15
15
  scopes = file.flat_map do |patterns, policies|
16
- sources = RubyFiles.select(project_path, patterns: [patterns])
17
- sources.flat_map { |s| { source: s, policies: policies } }
16
+ build_scope(patterns, policies, project_path)
18
17
  end
19
18
 
20
19
  sources = scopes.group_by { |e| e[:source] }
21
20
 
22
- sources.map do |source, group|
23
- policies = group.flat_map { |r| r[:policies] }.uniq
24
- Domain::SourcePolicies.new(source: source, policies: policies)
25
- end
21
+ sources.map(&method(:build_policies))
22
+ end
23
+
24
+ private
25
+
26
+ def build_policies(source, group)
27
+ policies = group.flat_map { |r| r[:policies] }.uniq
28
+ Domain::SourcePolicies.new(source: source, policies: policies)
29
+ end
30
+
31
+ def build_scope(patterns, policies, project_path)
32
+ sources = RubyFiles.select(project_path, patterns: [patterns])
33
+ sources.flat_map { |s| { source: s, policies: policies } }
26
34
  end
27
35
  end
28
36
  end
@@ -12,6 +12,8 @@ module Mudguard
12
12
  # Provides Mudguard Rake Tasks
13
13
  class Task < ::Rake::TaskLib
14
14
  def initialize(project_dir: Dir.pwd)
15
+ super()
16
+
15
17
  @project_dir = project_dir
16
18
 
17
19
  desc "Run Mudguard"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mudguard
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.5"
5
5
  end
data/mudguard.gemspec CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = spec.homepage
20
+ spec.required_ruby_version = ">= 2.5.3"
20
21
 
21
22
  # Specify which files should be added to the gem when it is released.
22
23
  # The `git ls-files -z` loads the files in the RubyGem that have been
@@ -37,6 +38,7 @@ Gem::Specification.new do |spec|
37
38
  spec.add_development_dependency "pry-doc", "~>1.0"
38
39
  spec.add_development_dependency "rake", "~>13.0"
39
40
  spec.add_development_dependency "rspec", "~> 3.9"
41
+ spec.add_development_dependency "rspec-github"
40
42
  spec.add_development_dependency "rubocop", "~>0.80"
41
43
 
42
44
  spec.add_dependency "parser", "~>2.7"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mudguard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorg Jenni
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-09 00:00:00.000000000 Z
11
+ date: 2021-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '3.9'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec-github
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: rubocop
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -173,6 +187,7 @@ extensions: []
173
187
  extra_rdoc_files: []
174
188
  files:
175
189
  - ".envrc"
190
+ - ".github/workflows/ruby.yml"
176
191
  - ".gitignore"
177
192
  - ".mudguard.yml"
178
193
  - ".rubocop.yml"
@@ -225,7 +240,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
240
  requirements:
226
241
  - - ">="
227
242
  - !ruby/object:Gem::Version
228
- version: '0'
243
+ version: 2.5.3
229
244
  required_rubygems_version: !ruby/object:Gem::Requirement
230
245
  requirements:
231
246
  - - ">="