-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use GitHub Actions for linting and testing as well as update gemspec #71
Changes from all commits
cc7c455
8852b8c
4a77a8c
c16afe8
2922514
95f4d54
058e994
2a3ff63
ef924be
324286a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
README.rdoc | ||
# Documentation listing for RDoc | ||
README.md | ||
lib/**/*.rb | ||
bin/* | ||
features/**/*.feature | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Top-level setting to indicate this is the root .editorconfig file | ||
root = true | ||
|
||
# Default settings for all files | ||
[*] | ||
# Enforce LF (\n) as the line ending across all files for consistency | ||
end_of_line = lf | ||
# Ensure every file ends with a newline | ||
insert_final_newline = true | ||
charset = utf-8 | ||
# Use spaces for indentation (as opposed to tabs) | ||
indent_style = space | ||
# Set the width of a single indentation level to 2 spaces | ||
indent_size = 2 | ||
trim_trailing_whitespace = true | ||
|
||
# Specific settings for Markdown files | ||
[*.md] | ||
# Disable trimming of trailing whitespace in Markdown files, | ||
# important for Markdown syntax where trailing spaces can be meaningful | ||
trim_trailing_whitespace = false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Linting | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
linting: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Lint YAML | ||
run: yamllint . | ||
|
||
- name: Set up Ruby and install dependencies | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
# uses .ruby-version implicitly | ||
bundler-cache: true | ||
|
||
- name: Lint Ruby code | ||
run: bundle exec rubocop |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
tests: | ||
strategy: | ||
matrix: | ||
# test a range of Ruby to ensure gem works | ||
# keep ruby until EOL. Read more on https://endoflife.date/ruby | ||
ruby-version: | ||
- '3.0' | ||
- '3.1' | ||
- '3.2' | ||
- '3.3' | ||
- head | ||
# test distributions up to 4 years | ||
runner: | ||
- ubuntu-22.04 | ||
- ubuntu-20.04 | ||
fail-fast: false # allow contributors understand failure builds | ||
|
||
runs-on: ${{ matrix.runner }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Ruby and install dependencies | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true | ||
|
||
- name: Run tests | ||
run: bundle exec rake spec |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,10 @@ | ||
## MAC OS | ||
## macOS | ||
.DS_Store | ||
|
||
## TEXTMATE | ||
*.tmproj | ||
tmtags | ||
|
||
## EMACS | ||
*~ | ||
\#* | ||
.\#* | ||
|
||
## VIM | ||
*.swp | ||
|
||
## PROJECT::GENERAL | ||
## Project specific | ||
coverage | ||
rdoc | ||
pkg | ||
|
||
## PROJECT::SPECIFIC | ||
*.rbc | ||
Gemfile.lock | ||
vendor/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
# merge the default 'Exclude' key with ours | ||
inherit_mode: | ||
merge: | ||
- Exclude | ||
|
||
require: | ||
- rubocop-rspec | ||
- rubocop-minitest | ||
- rubocop-packaging | ||
|
||
AllCops: | ||
NewCops: enable | ||
StyleGuideBaseURL: https://rubystyle.guide | ||
TargetRubyVersion: 3.0 | ||
SuggestExtensions: false # reduce noise. consider add rubocop-benchmark | ||
|
||
Exclude: | ||
- bin/**/* | ||
- tmp/**/* | ||
|
||
Bundler/OrderedGems: | ||
Include: | ||
- '*.gemspec' | ||
|
||
# Allow no documentation. | ||
Style/Documentation: | ||
Enabled: false | ||
|
||
# Enforce single quotes in the gem | ||
Style/StringLiterals: | ||
Enabled: true | ||
EnforcedStyle: single_quotes | ||
Comment on lines
+30
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the default, is your intention here to be explicit on these style decisions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I agree that we should use as many defaults as possible. For some rules that have a large "surface", I would mark them explicitly. |
||
|
||
Style/HashSyntax: | ||
EnforcedStyle: no_mixed_keys # consistent hash syntax | ||
EnforcedShorthandSyntax: consistent # enforce explicit hash syntax | ||
|
||
# Enforce dots on the next line for multi-line method calls | ||
Layout/DotPosition: | ||
EnforcedStyle: trailing | ||
|
||
# Project maximum code line length | ||
Layout/LineLength: | ||
Max: 120 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the default value. Recommend removing things that are default to reduce config size. |
||
|
||
Layout/FirstArrayElementIndentation: | ||
Enabled: true | ||
EnforcedStyle: consistent | ||
|
||
Layout/MultilineMethodCallIndentation: | ||
Enabled: true | ||
EnforcedStyle: indented | ||
|
||
Style/SymbolArray: | ||
EnforcedStyle: brackets # Prefer brackets | ||
|
||
Style/WordArray: | ||
EnforcedStyle: brackets # Prefer brackets | ||
|
||
Style/FrozenStringLiteralComment: | ||
Enabled: false | ||
|
||
# Exclude test files from BlockComments check | ||
Style/BlockComments: | ||
Exclude: | ||
- 'test/**/*' | ||
|
||
Metrics/ClassLength: | ||
Max: 500 | ||
|
||
Metrics/BlockLength: | ||
Max: 50 | ||
Exclude: | ||
# allows longer block for RSpec | ||
- spec/**/*.rb | ||
|
||
Metrics/AbcSize: | ||
Max: 110 | ||
|
||
Metrics/BlockNesting: | ||
Max: 5 | ||
|
||
Metrics/CyclomaticComplexity: | ||
Max: 40 | ||
|
||
Metrics/MethodLength: | ||
Max: 100 | ||
|
||
Metrics/ModuleLength: | ||
Max: 250 | ||
Exclude: | ||
# allows longer block for RSpec | ||
- spec/**/*.rb | ||
- lib/ffi-icu/lib.rb | ||
|
||
Metrics/PerceivedComplexity: | ||
Max: 50 | ||
|
||
RSpec/ExampleLength: | ||
Max: 20 | ||
|
||
RSpec/MultipleExpectations: | ||
Max: 10 | ||
|
||
RSpec/NestedGroups: | ||
Max: 5 | ||
|
||
RSpec/FilePath: | ||
Enabled: false | ||
|
||
RSpec/SpecFilePathFormat: | ||
Enabled: false | ||
|
||
RSpec/ContextWording: | ||
Enabled: false | ||
|
||
RSpec/NamedSubject: | ||
Enabled: false | ||
|
||
RSpec/MessageSpies: | ||
Enabled: false | ||
|
||
RSpec/NoExpectationExample: | ||
Enabled: false | ||
|
||
RSpec/MultipleDescribes: | ||
Enabled: false | ||
|
||
RSpec/DescribeClass: | ||
Enabled: false | ||
|
||
RSpec/PredicateMatcher: | ||
Enabled: false | ||
|
||
Naming/MethodParameterName: | ||
Enabled: false | ||
|
||
Naming/FileName: | ||
Exclude: | ||
- lib/ffi-icu.rb |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.2.3 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
extends: default | ||
|
||
locale: en_US.UTF-8 | ||
|
||
# ignored directories | ||
ignore: | | ||
.git/ | ||
|
||
rules: | ||
octal-values: enable | ||
|
||
document-start: disable | ||
document-end: disable | ||
|
||
# allow 120 characters in a line | ||
line-length: | ||
max: 120 | ||
level: error | ||
|
||
indentation: | ||
spaces: 2 | ||
indent-sequences: true | ||
|
||
# allow one space indent | ||
comments: | ||
level: error | ||
min-spaces-from-content: 1 | ||
|
||
# disallow boolean values to avoid surprise | ||
truthy: | ||
level: error | ||
|
||
# github workflows uses `on` as trigger | ||
ignore: | | ||
.github/workflows/*.yml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## [Unreleased](https://github.com/erickguan/ffi-icu/compare/v0.5.3...master) ## | ||
|
||
### Added | ||
|
||
|
||
### Changed | ||
|
||
- Required Ruby 3.0 and up. | ||
|
||
### Fixed | ||
|
||
|
||
### Removed | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
source 'https://rubygems.org' | ||
|
||
gemspec | ||
|
||
group :development, :test do | ||
gem 'rake', '>= 12.3.3' | ||
gem 'rspec', '~> 3.9' | ||
gem 'rubocop', '~> 1.60' | ||
gem 'rubocop-minitest', '~> 0.34.5' | ||
gem 'rubocop-packaging', '~> 0.5.2' | ||
gem 'rubocop-rspec', '~> 2.27' | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe later we can add rubocop-performance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!