Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldtse authored Nov 27, 2024
2 parents db3785b + 85d4f41 commit 3e7307b
Show file tree
Hide file tree
Showing 91 changed files with 1,758 additions and 1,554 deletions.
21 changes: 8 additions & 13 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
require:
- rubocop-performance

inherit_from:
- .rubocop_todo.yml
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
- .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.7
NewCops: enable
SuggestExtensions: false
Naming/VariableName:
Exclude:
- 'vendor/**/*'
- 'expressir.gemspec'
- 'tmp/**/*'
- 'pkg/**/*'
- 'exe/format-test'
- 'lib/expressir/express/**/*'
- 'lib/expressir/model/**/*'

- lib/expressir/express/visitor.rb
Layout/LineLength:
Max: 160
AllCops:
TargetRubyVersion: 2.7
75 changes: 69 additions & 6 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,84 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-11-19 15:15:51 UTC using RuboCop version 1.68.0.
# on 2024-11-26 21:06:12 UTC using RuboCop version 1.68.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: AllowedParentClasses.
Lint/MissingSuper:
Exclude:
- 'lib/expressir/model/cache.rb'

# Offense count: 3
Lint/ShadowingOuterLocalVariable:
Exclude:
- 'lib/expressir/express/visitor.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
# Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
Lint/UnusedMethodArgument:
Exclude:
- 'exe/expressir-format-test'
- 'lib/expressir/express/parser.rb'

# Offense count: 54
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
Metrics/AbcSize:
Exclude:
- 'lib/expressir/express/formatter.rb'
- 'lib/expressir/express/hyperlink_formatter.rb'
- 'lib/expressir/express/resolve_references_model_visitor.rb'
- 'lib/expressir/express/visitor.rb'
- 'lib/expressir/model/declarations/function.rb'
- 'lib/expressir/model/declarations/procedure.rb'
- 'lib/expressir/model/declarations/rule.rb'
- 'lib/expressir/model/declarations/schema.rb'
- 'lib/expressir/model/model_element.rb'

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 36
Max: 29

# Offense count: 40
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
Metrics/CyclomaticComplexity:
Exclude:
- 'lib/expressir/express/formatter.rb'
- 'lib/expressir/express/visitor.rb'
- 'lib/expressir/model/declarations/function.rb'
- 'lib/expressir/model/declarations/procedure.rb'
- 'lib/expressir/model/declarations/rule.rb'
- 'lib/expressir/model/declarations/schema.rb'
- 'lib/expressir/model/model_element.rb'

# Offense count: 74
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 135

# Offense count: 36
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
Metrics/PerceivedComplexity:
Exclude:
- 'lib/expressir/express/formatter.rb'
- 'lib/expressir/express/visitor.rb'
- 'lib/expressir/model/declarations/function.rb'
- 'lib/expressir/model/declarations/procedure.rb'
- 'lib/expressir/model/declarations/rule.rb'
- 'lib/expressir/model/declarations/schema.rb'
- 'lib/expressir/model/model_element.rb'

# Offense count: 5
Performance/FixedSize:
Exclude:
- 'lib/expressir/express/formatter.rb'

# Offense count: 1
Style/MissingRespondToMissing:
Exclude:
- 'lib/expressir/express/visitor.rb'
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem "pry"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "rubocop", "~> 1.21"
gem "rubocop-performance", require: false
gem "rubocop-performance"
gem "rubocop-rake", require: false
gem "rubocop-rspec", require: false
gem "webrick", "~> 1.7"
Expand Down
3 changes: 2 additions & 1 deletion exe/expressir-format-test
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ exp_files = [
"../iso-10303-stepmod/data/resources/security_classification_schema/security_classification_schema_annotated.exp",
"../iso-10303-stepmod/data/resources/support_resource_schema/support_resource_schema_annotated.exp",
# full test (6m18s + 8s = 6m26s)
# *`bundle exec ../stepmod-utils/exe/stepmod-find-express-files ../iso-10303-stepmod`.strip.split("\n").map{|file| File.exists?(file.sub(/\.exp$/, '_annotated.exp')) ? file.sub(/\.exp$/, '_annotated.exp') : file}
# *`bundle exec ../stepmod-utils/exe/stepmod-find-express-files ../iso-10303-stepmod`.strip
# .split("\n").map{|file| File.exists?(file.sub(/\.exp$/, '_annotated.exp')) ? file.sub(/\.exp$/, '_annotated.exp') : file}
]

start = Time.now
Expand Down
5 changes: 2 additions & 3 deletions expressir.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Gem::Specification.new do |spec|

spec.bindir = "exe"
spec.require_paths = ["lib"]
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = spec.homepage
Expand All @@ -33,7 +32,7 @@ Gem::Specification.new do |spec|

spec.test_files = `git ls-files -- {spec}/*`.split("\n")

spec.add_dependency "thor", "~> 1.0"
spec.add_dependency "parslet", "~> 2.0"
spec.add_dependency "liquid"
spec.add_dependency "parslet", "~> 2.0"
spec.add_dependency "thor", "~> 1.0"
end
12 changes: 6 additions & 6 deletions lib/expressir/express/cache.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'yaml'
require 'zlib'
require 'expressir/model'
require "yaml"
require "zlib"
require "expressir/model"

module Expressir
module Express
Expand All @@ -16,7 +16,7 @@ def self.to_file(file, content, root_path: nil, test_overwrite_version: nil)

cache = Model::Cache.new(
version: version,
content: content
content: content,
)

hash = cache.to_hash(root_path: root_path)
Expand All @@ -37,7 +37,7 @@ def self.from_file(file, root_path: nil, test_overwrite_version: nil)

yaml_compressed = File.binread(file)
yaml = Zlib::Inflate.inflate(yaml_compressed)
hash = YAML.load(yaml)
hash = YAML.safe_load(yaml)
cache = Model::ModelElement.from_hash(hash, root_path: root_path)

if cache.version != version
Expand All @@ -48,4 +48,4 @@ def self.from_file(file, root_path: nil, test_overwrite_version: nil)
end
end
end
end
end
Loading

0 comments on commit 3e7307b

Please sign in to comment.