rspec-big-infer 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +2 -2
- data/.github/workflows/semgrep.yml +38 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +69 -0
- data/README.md +27 -0
- data/docs/adr/0001-add-rspec-development-dependency.md +15 -0
- data/docs/adr/0001-use-env-ruby-for-shebang.md +16 -0
- data/exe/rspec-big-infer +9 -7
- data/lib/rspec/big/infer/formatter.rb +18 -1
- data/lib/rspec/big/infer/version.rb +1 -1
- data/lib/rspec/big/infer.rb +1 -1
- data/rspec-big-infer.gemspec +1 -0
- metadata +25 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bcd53f2c77b57ae50a4dcadfe19d40909b8f2685d7ebba6d6a53c793873ffd9
|
4
|
+
data.tar.gz: 274755ac6e0a42787097f058b234e4bb027a608d265cb3109cc8971a181acf41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d2688374577977f26729c95bc55d818e69e1813cee20bf1c30fd12c5181649c04a76358b0cbb1b572e168a43fb3d24e0533e764dcd6c8e256097d9dbe63a64a
|
7
|
+
data.tar.gz: abc36830a4e93d71aee199e9dcb3549902454055e88cafdd40e276d5770586a0c3c978e49447449bc2698f4b72e011d370e26c5d149ec00f17abe52885f03ebb
|
data/.github/workflows/main.yml
CHANGED
@@ -10,9 +10,9 @@ jobs:
|
|
10
10
|
- name: Set up Ruby
|
11
11
|
uses: ruby/setup-ruby@v1
|
12
12
|
with:
|
13
|
-
ruby-version:
|
13
|
+
ruby-version: 3.1.4
|
14
14
|
- name: Run the default task
|
15
15
|
run: |
|
16
|
-
gem install bundler -v 2.
|
16
|
+
gem install bundler -v 2.6.7
|
17
17
|
bundle install
|
18
18
|
bundle exec rake
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Name of this GitHub Actions workflow.
|
2
|
+
name: Semgrep CE scan
|
3
|
+
|
4
|
+
on:
|
5
|
+
# Scan in PRs:
|
6
|
+
pull_request: {}
|
7
|
+
# Scan on-demand through GitHub Actions interface:
|
8
|
+
workflow_dispatch: {}
|
9
|
+
# Scan mainline branches and report all findings:
|
10
|
+
push:
|
11
|
+
branches: ["master", "main"]
|
12
|
+
# Schedule the CI job (this method uses cron syntax):
|
13
|
+
schedule:
|
14
|
+
- cron: '20 17 * * *' # Sets Semgrep to scan every day at 17:20 UTC.
|
15
|
+
# It is recommended to change the schedule to a random time.
|
16
|
+
|
17
|
+
permissions:
|
18
|
+
contents: read
|
19
|
+
|
20
|
+
jobs:
|
21
|
+
semgrep:
|
22
|
+
# User definable name of this GitHub Actions job.
|
23
|
+
name: semgrep-oss/scan
|
24
|
+
# If you are self-hosting, change the following `runs-on` value:
|
25
|
+
runs-on: ubuntu-latest
|
26
|
+
|
27
|
+
container:
|
28
|
+
# A Docker image with Semgrep installed. Do not change this.
|
29
|
+
image: semgrep/semgrep
|
30
|
+
|
31
|
+
# Skip any PR created by dependabot to avoid permission issues:
|
32
|
+
if: (github.actor != 'dependabot[bot]')
|
33
|
+
|
34
|
+
steps:
|
35
|
+
# Fetch project source with GitHub Actions Checkout. Use either v3 or v4.
|
36
|
+
- uses: actions/checkout@v4
|
37
|
+
# Run the "semgrep scan" command on the command line of the docker image.
|
38
|
+
- run: semgrep scan --config=p/ci --metrics=off
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rspec-big-infer (0.7.0)
|
5
|
+
rspec-core (~> 3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.3)
|
11
|
+
diff-lcs (1.6.2)
|
12
|
+
json (2.12.2)
|
13
|
+
language_server-protocol (3.17.0.5)
|
14
|
+
lint_roller (1.1.0)
|
15
|
+
minitest (5.25.5)
|
16
|
+
parallel (1.27.0)
|
17
|
+
parser (3.3.8.0)
|
18
|
+
ast (~> 2.4.1)
|
19
|
+
racc
|
20
|
+
prism (1.4.0)
|
21
|
+
racc (1.8.1)
|
22
|
+
rainbow (3.1.1)
|
23
|
+
rake (13.3.0)
|
24
|
+
regexp_parser (2.10.0)
|
25
|
+
rspec (3.13.1)
|
26
|
+
rspec-core (~> 3.13.0)
|
27
|
+
rspec-expectations (~> 3.13.0)
|
28
|
+
rspec-mocks (~> 3.13.0)
|
29
|
+
rspec-core (3.13.4)
|
30
|
+
rspec-support (~> 3.13.0)
|
31
|
+
rspec-expectations (3.13.5)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.13.0)
|
34
|
+
rspec-mocks (3.13.5)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.13.0)
|
37
|
+
rspec-support (3.13.4)
|
38
|
+
rubocop (1.76.0)
|
39
|
+
json (~> 2.3)
|
40
|
+
language_server-protocol (~> 3.17.0.2)
|
41
|
+
lint_roller (~> 1.1.0)
|
42
|
+
parallel (~> 1.10)
|
43
|
+
parser (>= 3.3.0.2)
|
44
|
+
rainbow (>= 2.2.2, < 4.0)
|
45
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
46
|
+
rubocop-ast (>= 1.45.0, < 2.0)
|
47
|
+
ruby-progressbar (~> 1.7)
|
48
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
49
|
+
rubocop-ast (1.45.0)
|
50
|
+
parser (>= 3.3.7.2)
|
51
|
+
prism (~> 1.4)
|
52
|
+
ruby-progressbar (1.13.0)
|
53
|
+
unicode-display_width (3.1.4)
|
54
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
55
|
+
unicode-emoji (4.0.4)
|
56
|
+
|
57
|
+
PLATFORMS
|
58
|
+
ruby
|
59
|
+
x86_64-linux
|
60
|
+
|
61
|
+
DEPENDENCIES
|
62
|
+
minitest (~> 5.0)
|
63
|
+
rake (~> 13.0)
|
64
|
+
rspec (~> 3)
|
65
|
+
rspec-big-infer!
|
66
|
+
rubocop (~> 1.7)
|
67
|
+
|
68
|
+
BUNDLED WITH
|
69
|
+
2.6.7
|
data/README.md
CHANGED
@@ -16,3 +16,30 @@ bundle add rspec-big-infer
|
|
16
16
|
* It works based on `described_class` and `const_source_location`
|
17
17
|
2. (optional) Printout tests that will be run based on infer: `git diff --name-only --diff-filter=D origin/develop | bundle exec rspec-big-infer tmp/rspec_infer.json`
|
18
18
|
3. Run tests with `bundle exec rspec $(git diff --name-only --diff-filter=D origin/develop | bundle exec rspec-big-infer tmp/rspec_infer.json)` to run tests based on the changes in the codebase.
|
19
|
+
|
20
|
+
## Example runner file
|
21
|
+
|
22
|
+
`bin/run-infer-rspec`
|
23
|
+
```bash
|
24
|
+
#!/bin/bash
|
25
|
+
|
26
|
+
set -e
|
27
|
+
|
28
|
+
if [ -z "$(git status --porcelain)" ]; then
|
29
|
+
echo "Working directory is clean. Proceeding with the infer script..."
|
30
|
+
else
|
31
|
+
echo "WARNING! Changes detected in the working directory. Infer script will not work correctly"
|
32
|
+
fi
|
33
|
+
|
34
|
+
echo "Updating git repository to get the latest changes from develop branch..."
|
35
|
+
git fetch origin develop > /dev/null 2>&1 || echo "Warning: Could not fetch from origin/develop. Continuing without update."
|
36
|
+
|
37
|
+
echo "Calculating relationships between files..."
|
38
|
+
bundle exec rspec --dry-run --format RSpec::Big::Infer::Formatter --out tmp/rspec_infer.json 2> /dev/null
|
39
|
+
|
40
|
+
echo "Parsing rspec_infer.json and suggesting tests to run..."
|
41
|
+
git diff --name-only origin/develop | bundle exec rspec-big-infer tmp/rspec_infer.json
|
42
|
+
|
43
|
+
echo "Running the tests..."
|
44
|
+
bundle exec rspec $(git diff --name-only origin/develop | bundle exec rspec-big-infer tmp/rspec_infer.json)
|
45
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# 0001 Add RSpec development dependency
|
2
|
+
|
3
|
+
Date: 2025-05-22
|
4
|
+
|
5
|
+
## Status
|
6
|
+
Accepted
|
7
|
+
|
8
|
+
## Context
|
9
|
+
RSpec is used for testing this gem, but it was not included in the Gemfile. Without it, running specs via Bundler fails.
|
10
|
+
|
11
|
+
## Decision
|
12
|
+
Add `gem "rspec", "~> 3"` under the `development` group in the Gemfile. Running `bundle install` will lock the dependency.
|
13
|
+
|
14
|
+
## Consequences
|
15
|
+
Developers can run `bundle exec rake spec` without globally installed RSpec. The gemspec remains unchanged.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# 1. Use `/usr/bin/env ruby` for shebang
|
2
|
+
|
3
|
+
Date: 2025-06-05
|
4
|
+
|
5
|
+
## Status
|
6
|
+
Accepted
|
7
|
+
|
8
|
+
## Context
|
9
|
+
The executable `exe/rspec-big-infer` previously used `#!/bin/env ruby` as its shebang.
|
10
|
+
Some systems do not provide `/bin/env`, but most provide `/usr/bin/env`.
|
11
|
+
|
12
|
+
## Decision
|
13
|
+
Update the shebang line in `exe/rspec-big-infer` to `#!/usr/bin/env ruby` to increase portability.
|
14
|
+
|
15
|
+
## Consequences
|
16
|
+
The script now uses the more common path for `env`, improving compatibility across environments.
|
data/exe/rspec-big-infer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/bin/env ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "json"
|
@@ -9,12 +9,14 @@ if ARGV[0]
|
|
9
9
|
all_rspec_examples = JSON.parse(File.read(path))["examples"]
|
10
10
|
changed_files = $stdin.read.split("\n")
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
puts(
|
13
|
+
all_rspec_examples.compact.map do |test|
|
14
|
+
if changed_files.include?(test["described_class_defined_source_location"]) ||
|
15
|
+
changed_files.include?(test["test_file_path"])
|
16
|
+
test["test_file_path"]
|
17
|
+
end
|
18
|
+
end.compact.uniq.join("\n")
|
19
|
+
)
|
18
20
|
|
19
21
|
else
|
20
22
|
warn "Usage: git diff --name-only origin/develop | rspec-big-infer <path to JSON test map file>"
|
@@ -12,7 +12,9 @@ module RSpec
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def format_example(example)
|
15
|
-
return
|
15
|
+
return {} if already_processed?(example.file_path)
|
16
|
+
|
17
|
+
already_processed!(example.file_path)
|
16
18
|
|
17
19
|
{
|
18
20
|
test_file_path: relative_path(example.file_path),
|
@@ -21,6 +23,8 @@ module RSpec
|
|
21
23
|
end
|
22
24
|
|
23
25
|
def source_location(klass)
|
26
|
+
return unless klass.is_a?(Class)
|
27
|
+
|
24
28
|
relative_path(klass.const_source_location(klass.name).first)
|
25
29
|
end
|
26
30
|
|
@@ -33,6 +37,19 @@ module RSpec
|
|
33
37
|
path
|
34
38
|
end
|
35
39
|
end
|
40
|
+
|
41
|
+
def already_processed!(test_file_path)
|
42
|
+
# Prevents the formatter from processing the same file multiple times
|
43
|
+
@already_processed ||= Set.new
|
44
|
+
return if @already_processed.include?(test_file_path)
|
45
|
+
|
46
|
+
@already_processed.add(test_file_path)
|
47
|
+
end
|
48
|
+
|
49
|
+
def already_processed?(test_file_path)
|
50
|
+
@already_processed ||= Set.new
|
51
|
+
@already_processed.include?(test_file_path)
|
52
|
+
end
|
36
53
|
end
|
37
54
|
end
|
38
55
|
end
|
data/lib/rspec/big/infer.rb
CHANGED
data/rspec-big-infer.gemspec
CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = ["rspec-big-infer"]
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
spec.add_dependency "rspec-core", "~> 3"
|
30
|
+
spec.add_development_dependency "rspec", "~> 3"
|
30
31
|
|
31
32
|
# For more information and examples about making a new gem, checkout our
|
32
33
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-big-infer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patryk Ptasinski
|
8
|
+
autorequire:
|
8
9
|
bindir: exe
|
9
10
|
cert_chain: []
|
10
|
-
date: 2025-
|
11
|
+
date: 2025-07-10 00:00:00.000000000 Z
|
11
12
|
dependencies:
|
12
13
|
- !ruby/object:Gem::Dependency
|
13
14
|
name: rspec-core
|
@@ -23,6 +24,21 @@ dependencies:
|
|
23
24
|
- - "~>"
|
24
25
|
- !ruby/object:Gem::Version
|
25
26
|
version: '3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3'
|
41
|
+
description:
|
26
42
|
email:
|
27
43
|
- patryk@ipepe.pl
|
28
44
|
executables:
|
@@ -31,14 +47,18 @@ extensions: []
|
|
31
47
|
extra_rdoc_files: []
|
32
48
|
files:
|
33
49
|
- ".github/workflows/main.yml"
|
50
|
+
- ".github/workflows/semgrep.yml"
|
34
51
|
- ".gitignore"
|
35
52
|
- ".rubocop.yml"
|
36
53
|
- Gemfile
|
54
|
+
- Gemfile.lock
|
37
55
|
- LICENSE
|
38
56
|
- README.md
|
39
57
|
- Rakefile
|
40
58
|
- bin/console
|
41
59
|
- bin/setup
|
60
|
+
- docs/adr/0001-add-rspec-development-dependency.md
|
61
|
+
- docs/adr/0001-use-env-ruby-for-shebang.md
|
42
62
|
- exe/rspec-big-infer
|
43
63
|
- lib/rspec/big/infer.rb
|
44
64
|
- lib/rspec/big/infer/formatter.rb
|
@@ -53,6 +73,7 @@ metadata:
|
|
53
73
|
homepage_uri: https://github.com/ipepe-oss/rspec-big-infer
|
54
74
|
source_code_uri: https://github.com/ipepe-oss/rspec-big-infer
|
55
75
|
changelog_uri: https://github.com/ipepe-oss/rspec-big-infer
|
76
|
+
post_install_message:
|
56
77
|
rdoc_options: []
|
57
78
|
require_paths:
|
58
79
|
- lib
|
@@ -67,7 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
88
|
- !ruby/object:Gem::Version
|
68
89
|
version: '0'
|
69
90
|
requirements: []
|
70
|
-
rubygems_version: 3.
|
91
|
+
rubygems_version: 3.3.26
|
92
|
+
signing_key:
|
71
93
|
specification_version: 4
|
72
94
|
summary: Infer which RSpec test files to run based on currently changed files
|
73
95
|
test_files: []
|