Skip to content

Commit

Permalink
Merge b44ae75 into dc7cb17
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzedge committed May 15, 2023
2 parents dc7cb17 + b44ae75 commit e76d312
Show file tree
Hide file tree
Showing 25 changed files with 287 additions and 165 deletions.
33 changes: 32 additions & 1 deletion .codeclimate.yml
@@ -1,2 +1,33 @@
exclude_paths:
exclude_patterns:
- 'tasks/'
plugins:
# No to-dos or similar
fixme:
enabled: true
exclude_patterns:
- '.rubocop.*'
# ABC-complexity
flog:
enabled: true
config:
score_threshold: 25.0
exclude_patterns:
- 'spec/'
# Markdown lint with rules from https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md
markdownlint:
enabled: true
# Code smells
reek:
enabled: true
exclude_patterns:
- 'spec/'
# Ruby lint
rubocop:
enabled: true
channel: rubocop-1-50-2
# Semgrep Ruby rules
semgrep:
enabled: true
runs:
- configs:
- rules/ruby/lang
4 changes: 4 additions & 0 deletions .mdl_style.rb
@@ -0,0 +1,4 @@
# frozen_string_literal: true

rule 'MD013', line_length: 120
rule 'MD029', style: 'ordered'
1 change: 1 addition & 0 deletions .mdlrc
@@ -0,0 +1 @@
style '.mdl_style.rb'
97 changes: 49 additions & 48 deletions .rubocop.yml
Expand Up @@ -29,6 +29,37 @@ Layout/AccessModifierIndentation:
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation

# checks whether the end keywords are aligned properly for `do` `end` blocks.
Layout/BlockAlignment:
# The value `start_of_block` means that the `end` should be aligned with line
# where the `do` keyword appears.
# The value `start_of_line` means it should be aligned with the whole
# expression's starting line.
# The value `either` means both are allowed.
EnforcedStyleAlignWith: start_of_line

Layout/DefEndAlignment:
# The value `def` means that `end` should be aligned with the def keyword.
# The value `start_of_line` means that `end` should be aligned with method
# calls like `private`, `public`, etc, if present in front of the `def`
# keyword on the same line.
EnforcedStyleAlignWith: start_of_line
# AutoCorrect: false
Severity: warning

# Align ends correctly.
Layout/EndAlignment:
# The value `keyword` means that `end` should be aligned with the matching
# keyword (`if`, `while`, etc.).
# The value `variable` means that in assignments, `end` should be aligned
# with the start of the variable on the left hand side of `=`. In all other
# situations, `end` should still be aligned with the keyword.
# The value `start_of_line` means that `end` should be aligned with the start
# of the line which the matching keyword appears on.
EnforcedStyleAlignWith: start_of_line
# AutoCorrect: false
Severity: warning

# Align the elements of a hash literal if they span more than one line.
Layout/HashAlignment:
# Alignment of entries using colon as separator. Valid values are:
Expand Down Expand Up @@ -76,6 +107,23 @@ Layout/HashAlignment:
# b: 2)
EnforcedLastArgumentHashStyle: ignore_implicit

Layout/LineLength:
Max: 120
# To make it possible to copy or click on URIs in the code, we allow lines
# containing a URI to be longer than Max.
AllowHeredoc: true
AllowURI: true
URISchemes:
- http
- https
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
# directives like '# rubocop: enable ...' when calculating a line's length.
IgnoreCopDirectives: false
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
# elements. Strings will be converted to Regexp objects. A line that matches
# any regular expression listed in this option will be ignored by LineLength.
IgnoredPatterns: []

Layout/ParameterAlignment:
# Alignment of parameters in multi-line method calls.
#
Expand Down Expand Up @@ -1304,23 +1352,6 @@ Metrics/ClassLength:
Metrics/CyclomaticComplexity:
Max: 6

Layout/LineLength:
Max: 80
# To make it possible to copy or click on URIs in the code, we allow lines
# containing a URI to be longer than Max.
AllowHeredoc: true
AllowURI: true
URISchemes:
- http
- https
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
# directives like '# rubocop: enable ...' when calculating a line's length.
IgnoreCopDirectives: false
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
# elements. Strings will be converted to Regexp objects. A line that matches
# any regular expression listed in this option will be ignored by LineLength.
IgnoredPatterns: []

Metrics/MethodLength:
CountComments: false # count full line comments?
Max: 20
Expand All @@ -1331,6 +1362,7 @@ Metrics/ModuleLength:

Metrics/ParameterLists:
Max: 5
MaxOptionalParameters: 5
CountKeywordArgs: true

Metrics/PerceivedComplexity:
Expand All @@ -1342,37 +1374,6 @@ Metrics/PerceivedComplexity:
Lint/AssignmentInCondition:
AllowSafeAssignment: true

# checks whether the end keywords are aligned properly for `do` `end` blocks.
Layout/BlockAlignment:
# The value `start_of_block` means that the `end` should be aligned with line
# where the `do` keyword appears.
# The value `start_of_line` means it should be aligned with the whole
# expression's starting line.
# The value `either` means both are allowed.
EnforcedStyleAlignWith: start_of_line

Layout/DefEndAlignment:
# The value `def` means that `end` should be aligned with the def keyword.
# The value `start_of_line` means that `end` should be aligned with method
# calls like `private`, `public`, etc, if present in front of the `def`
# keyword on the same line.
EnforcedStyleAlignWith: start_of_line
# AutoCorrect: false
Severity: warning

# Align ends correctly.
Layout/EndAlignment:
# The value `keyword` means that `end` should be aligned with the matching
# keyword (`if`, `while`, etc.).
# The value `variable` means that in assignments, `end` should be aligned
# with the start of the variable on the left hand side of `=`. In all other
# situations, `end` should still be aligned with the keyword.
# The value `start_of_line` means that `end` should be aligned with the start
# of the line which the matching keyword appears on.
EnforcedStyleAlignWith: start_of_line
# AutoCorrect: false
Severity: warning

Lint/SuppressedException:
Exclude:
- 'spec/**/*'
Expand Down
25 changes: 9 additions & 16 deletions CHANGELOG.md
@@ -1,3 +1,5 @@
# CHANGELOG

## 2.3.2 [compare][compare_v2_3_1_and_master]

## 2.3.1 [compare][compare_v2_3_0_and_v2_3_1]
Expand Down Expand Up @@ -60,7 +62,7 @@
- Add `Readers::Reader` and `Serializer::Serializer` base classes
- Make all readers/serializers extend from their corresponding base classes
- Better docs with `Reader`/`Serializer` and generics
- Fix all code blocks from `\`` to `+` and add some more
- Fix all code blocks from backtick to `+` and add some more
- Add `@return [void]` where appropriate
- Add `@return [self]` where appropriate
- Fix `Nodes::Node` duplicate and broken references
Expand Down Expand Up @@ -319,20 +321,15 @@ Most of these help with the gem's overall performance.

- Add Ruby 2.4 to supported versions by [@gonzedge][github_user_gonzedge]
- Drastically reduce size of gem by [@gonzedge][github_user_gonzedge]

By excluding unnecessary `assets/` and `reports/` when building the gem.
**Size reduction**: from ~472KB to ~21KB.

- By excluding unnecessary `assets/` and `reports/` when building the gem.
- **Size reduction**: from ~472KB to ~21KB.
- Make root node accessible via container by [@gonzedge][github_user_gonzedge]

So that anyone using rambling-trie can develop their custom algorithms

- So that anyone using rambling-trie can develop their custom algorithms
- Expose root node's `#to_a` method through `Container` by
[@gonzedge][github_user_gonzedge]
- Add own `Forwardable#delegate` because of [Ruby 2.4 performance
degradation][ruby_bug_13111] by [@gonzedge][github_user_gonzedge]

Was able to take Creation and Compression benchmarks (~8.8s and ~1.5s
- Was able to take Creation and Compression benchmarks (~8.8s and ~1.5s
respectively) back down to the Ruby 2.3.3 levels by adding own definition of
`Forwardable#delegate`.

Expand Down Expand Up @@ -411,16 +408,12 @@ Most of these help with the gem's overall performance.

- `Rambling::Trie.create` now returns a `Container` instead of a `Root` by
[@gonzedge][github_user_gonzedge]

`Container` exposes these API entry points:

- `Container` exposes these API entry points:
- `#partial_word?` and its alias `#match?`
- `#word?` and its alias `#include?`
- `#add` and its alias `#<<`
- yield the constructed `Container` on `#initialize`

`Rambling::Trie::Node` and its subclasses no longer expose:

- `Rambling::Trie::Node` and its subclasses no longer expose:
- `#match?`
- `#include?`
- `#<<`
Expand Down
11 changes: 7 additions & 4 deletions CONTRIBUTING.md
@@ -1,12 +1,15 @@
## Contributing to Rambling Trie
# Contributing to Rambling Trie

1. If you have found a bug or have a feature request, please [search through the issues][github_issues_all] to see if it has already been reported. If that's not the case, then [create a new one][github_issues_new] with a full description of what you have found or what you need.
2. If you have bug fix or a feature implementation in mind, then [fork Rambling Trie][github_fork] and create a branch with a descriptive name.
1. If you have found a bug or have a feature request, please [search through the issues][github_issues_all] to see if it
has already been reported. If that's not the case, then [create a new one][github_issues_new] with a full description
of what you have found or what you need.
2. If you have bug fix or a feature implementation in mind, then [fork Rambling Trie][github_fork] and create a branch
with a descriptive name.
3. Get the gem up and running locally (tests are written in RSpec):

```sh
bundle install
rake
bundle exec rake
```

4. Implement your bug fix or feature - ***make sure to add tests!***
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -16,7 +16,7 @@ group :development do
end

group :test do
gem 'coveralls_reborn', '~> 0.27.0', require: false
gem 'coveralls_reborn', require: false
gem 'rspec_junit_formatter'
gem 'simplecov', require: false
end
Expand Down

0 comments on commit e76d312

Please sign in to comment.