Class: WayOfWorking::Audit::Github::Rules::Base
- Inherits:
-
Object
- Object
- WayOfWorking::Audit::Github::Rules::Base
- Defined in:
- lib/way_of_working/audit/github/rules/base.rb
Overview
This is the base class for GitHub audit rules
Direct Known Subclasses
Unknown, Changelog::Keepachangelog::GithubAuditRule, CodeOfConduct::ContributorCovenant::GithubAuditRule, DecisionRecord::Madr::GithubAuditRule, InclusiveLanguage::Alex::GithubAuditRule, PullRequestTemplate::Hdi::GithubAuditRule, ReadmeBadge::GithubAuditRule, Versioning::Semver::GithubAuditRule
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#fix ⇒ Object
readonly
Returns the value of attribute fix.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rulesets ⇒ Object
Returns the value of attribute rulesets.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Class Method Summary collapse
-
.source_root(path = nil) ⇒ Object
Stores and return the source root for this class.
- .tags ⇒ Object
Instance Method Summary collapse
-
#initialize(client, name, repo, rulesets, fix = false) ⇒ Base
constructor
A new instance of Base.
- #status ⇒ Object
- #tags ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize(client, name, repo, rulesets, fix = false) ⇒ Base
Returns a new instance of Base.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 26 def initialize(client, name, repo, rulesets, fix = false) @client = client @name = name @repo = repo @repo_name = repo.full_name @rulesets = rulesets @fix = fix @errors = [] @warnings = [] end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
15 16 17 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 15 def errors @errors end |
#fix ⇒ Object (readonly)
Returns the value of attribute fix.
16 17 18 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 16 def fix @fix end |
#name ⇒ Object
Returns the value of attribute name.
15 16 17 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 15 def name @name end |
#rulesets ⇒ Object
Returns the value of attribute rulesets.
15 16 17 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 15 def rulesets @rulesets end |
#warnings ⇒ Object
Returns the value of attribute warnings.
15 16 17 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 15 def warnings @warnings end |
Class Method Details
.source_root(path = nil) ⇒ Object
Stores and return the source root for this class
20 21 22 23 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 20 def source_root(path = nil) @source_root = path if path @source_root ||= nil end |
.tags ⇒ Object
54 55 56 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 54 def self. [:way_of_working] end |
Instance Method Details
#status ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 37 def status @status ||= begin result = validate if result == :not_applicable result else @errors.empty? ? :passed : :failed end end end |
#tags ⇒ Object
58 59 60 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 58 def self.class. end |
#validate ⇒ Object
49 50 51 52 |
# File 'lib/way_of_working/audit/github/rules/base.rb', line 49 def validate $stdout.puts "Rule#valid? has been deprecated, use \"validate\" in #{self.class.name}" valid? end |