polariscope 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -0
- data/CHANGELOG.md +8 -0
- data/README.md +0 -8
- data/lib/polariscope/scanner/codebase_health_score.rb +14 -1
- data/lib/polariscope/version.rb +1 -1
- data/lib/polariscope.rb +0 -5
- metadata +2 -3
- data/lib/polariscope/color/hsl.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bedcc2db6f82679631ccdd4d7d3b007beaa22421639347301ab37e43796cab9a
|
4
|
+
data.tar.gz: fb9904ba457696f0409c7b6162ad99843c8abae2d23d26dfc10391bc306bdd53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c986b31f221691c6de5ffc81d354b07bbd96a2003b5537a8f59d2e74fd1733f39f348be129c6ec9d65b5491131aabda10ee14b8e6a27a55f73dfc7882210c09
|
7
|
+
data.tar.gz: 68377f2df1b43e99b9cd2ff88a2b9cfac558246dac6144ea77d011112bcf48b4e44f979a663499e2fdc21e751d1ac333a556dd99630d8073af4f9be6d5142dba
|
data/.rubocop.yml
CHANGED
@@ -11,6 +11,18 @@ AllCops:
|
|
11
11
|
RSpec/MultipleExpectations:
|
12
12
|
Max: 5
|
13
13
|
|
14
|
+
RSpec/NestedGroups:
|
15
|
+
Max: 5
|
16
|
+
|
17
|
+
RSpec/MultipleMemoizedHelpers:
|
18
|
+
Enabled: false
|
19
|
+
|
14
20
|
Style/FrozenStringLiteralComment:
|
15
21
|
Exclude:
|
16
22
|
- 'exe/polariscope'
|
23
|
+
|
24
|
+
Rails/TimeZone:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Rails/Date:
|
28
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.0] - 2024-08-23
|
4
|
+
|
5
|
+
- Check if audit database is missing or stale (older than 7 weeks) & update if true
|
6
|
+
|
7
|
+
## [0.1.3] - 2024-08-12
|
8
|
+
|
9
|
+
- Remove color#hsl feature
|
10
|
+
|
3
11
|
## [0.1.2] - 2024-08-08
|
4
12
|
|
5
13
|
- Fix issue when no Gemfile found in project & reach 100% coverage with tests
|
data/README.md
CHANGED
@@ -55,14 +55,6 @@ The return value will indicate how healthy your project is on a scale from 0 to
|
|
55
55
|
|
56
56
|
#### Additional features
|
57
57
|
|
58
|
-
##### Score color
|
59
|
-
|
60
|
-
Get the score color for a score:
|
61
|
-
|
62
|
-
```ruby
|
63
|
-
Polariscope.score_color(60.75)
|
64
|
-
```
|
65
|
-
|
66
58
|
##### Gem versions
|
67
59
|
|
68
60
|
Get the released or latest version of gems with:
|
@@ -17,7 +17,8 @@ module Polariscope
|
|
17
17
|
|
18
18
|
begin
|
19
19
|
GemfileHealthScore.new(gemfile_path: gemfile_file.path, gemfile_lock_content: gemfile_lock_content,
|
20
|
-
bundler_audit_config_path: bundler_audit_config_file.path
|
20
|
+
bundler_audit_config_path: bundler_audit_config_file.path,
|
21
|
+
update_audit_database: update_audit_database?).health_score
|
21
22
|
ensure
|
22
23
|
gemfile_file.unlink
|
23
24
|
bundler_audit_config_file.unlink
|
@@ -51,6 +52,18 @@ module Polariscope
|
|
51
52
|
def blank?(value)
|
52
53
|
value.nil? || value == ''
|
53
54
|
end
|
55
|
+
|
56
|
+
def update_audit_database?
|
57
|
+
audit_db_missing? || audit_db_stale?
|
58
|
+
end
|
59
|
+
|
60
|
+
def audit_db_missing?
|
61
|
+
!Bundler::Audit::Database.exists?
|
62
|
+
end
|
63
|
+
|
64
|
+
def audit_db_stale?
|
65
|
+
((Time.now - Bundler::Audit::Database.new.last_updated_at) / 86_400) > 7
|
66
|
+
end
|
54
67
|
end
|
55
68
|
end
|
56
69
|
end
|
data/lib/polariscope/version.rb
CHANGED
data/lib/polariscope.rb
CHANGED
@@ -4,7 +4,6 @@ require_relative 'polariscope/version'
|
|
4
4
|
require_relative 'polariscope/scanner/codebase_health_score'
|
5
5
|
require_relative 'polariscope/scanner/gem_versions'
|
6
6
|
require_relative 'polariscope/file_content'
|
7
|
-
require_relative 'polariscope/color/hsl'
|
8
7
|
|
9
8
|
module Polariscope
|
10
9
|
Error = Class.new(StandardError)
|
@@ -18,10 +17,6 @@ module Polariscope
|
|
18
17
|
).health_score
|
19
18
|
end
|
20
19
|
|
21
|
-
def score_color(score)
|
22
|
-
Color::Hsl.for(score)
|
23
|
-
end
|
24
|
-
|
25
20
|
def gem_versions(dependency_names, spec_type: :released)
|
26
21
|
Scanner::GemVersions.new(dependency_names, spec_type: spec_type)
|
27
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polariscope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rails team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,7 +55,6 @@ files:
|
|
55
55
|
- Rakefile
|
56
56
|
- exe/polariscope
|
57
57
|
- lib/polariscope.rb
|
58
|
-
- lib/polariscope/color/hsl.rb
|
59
58
|
- lib/polariscope/file_content.rb
|
60
59
|
- lib/polariscope/scanner/codebase_health_score.rb
|
61
60
|
- lib/polariscope/scanner/gem_health_score.rb
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Polariscope
|
4
|
-
module Color
|
5
|
-
class Hsl
|
6
|
-
MAX_HUE = 120
|
7
|
-
|
8
|
-
class << self
|
9
|
-
def for(score)
|
10
|
-
new(score).hsl
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def initialize(score)
|
15
|
-
@score = score
|
16
|
-
end
|
17
|
-
|
18
|
-
def hsl
|
19
|
-
return '' unless score
|
20
|
-
|
21
|
-
"hsl(#{hue}, 100%, 45%)"
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
attr_reader :score
|
27
|
-
|
28
|
-
def hue
|
29
|
-
(MAX_HUE * (rounded_score / 100.0)).round
|
30
|
-
end
|
31
|
-
|
32
|
-
def rounded_score
|
33
|
-
(score / 5).round * 5
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|