chore: format project
This commit is contained in:
36
.gitea/workflows/code-quality.yaml
Normal file
36
.gitea/workflows/code-quality.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Code Quality
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: .ruby-version
|
||||
bundler-cache: true
|
||||
|
||||
- name: Check formatting
|
||||
run: bundle exec rubocop --only Layout --parallel
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
needs: format
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: .ruby-version
|
||||
bundler-cache: true
|
||||
|
||||
- name: Run lint
|
||||
run: bundle exec rubocop --except Layout --parallel
|
@@ -3,14 +3,17 @@ on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
test-project:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
- name: Install dependencies
|
||||
run: bundle install
|
||||
with:
|
||||
ruby-version: .ruby-version
|
||||
bundler-cache: true
|
||||
|
||||
- name: Run tests
|
||||
run: bundle exec rake test
|
@@ -1,3 +1,6 @@
|
||||
AllCops:
|
||||
TargetRubyVersion: 3.4
|
||||
NewCops: enable
|
||||
plugins:
|
||||
- rubocop-minitest
|
||||
- rubocop-rake
|
||||
|
2
Gemfile
2
Gemfile
@@ -8,3 +8,5 @@ gem 'minitest', '~> 5.25'
|
||||
gem 'rake', '~> 13.3'
|
||||
|
||||
gem 'rubocop', require: false
|
||||
gem 'rubocop-minitest', '~> 0.38.2', require: false
|
||||
gem 'rubocop-rake', '~> 0.7.1', require: false
|
||||
|
@@ -29,6 +29,13 @@ GEM
|
||||
rubocop-ast (1.46.0)
|
||||
parser (>= 3.3.7.2)
|
||||
prism (~> 1.4)
|
||||
rubocop-minitest (0.38.2)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (>= 1.75.0, < 2.0)
|
||||
rubocop-ast (>= 1.38.0, < 2.0)
|
||||
rubocop-rake (0.7.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (>= 1.72.1)
|
||||
ruby-progressbar (1.13.0)
|
||||
unicode-display_width (3.1.5)
|
||||
unicode-emoji (~> 4.0, >= 4.0.4)
|
||||
@@ -42,6 +49,8 @@ DEPENDENCIES
|
||||
minitest (~> 5.25)
|
||||
rake (~> 13.3)
|
||||
rubocop
|
||||
rubocop-minitest (~> 0.38.2)
|
||||
rubocop-rake (~> 0.7.1)
|
||||
|
||||
BUNDLED WITH
|
||||
2.7.1
|
||||
|
9
Rakefile
9
Rakefile
@@ -1,7 +1,8 @@
|
||||
require "rake/testtask"
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rake/testtask'
|
||||
|
||||
Rake::TestTask.new(:test) do |t|
|
||||
t.libs << "tests"
|
||||
t.test_files = FileList["tests/**/*_test.rb"]
|
||||
t.libs << 'tests'
|
||||
t.test_files = FileList['tests/**/*_test.rb']
|
||||
end
|
||||
|
||||
|
4
main.rb
4
main.rb
@@ -1,6 +1,8 @@
|
||||
#! /usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
# main
|
||||
def main
|
||||
0
|
||||
end
|
||||
|
||||
main if __FILE__ == $PROGRAM_NAME
|
||||
|
@@ -1,8 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'minitest/autorun'
|
||||
require_relative '../main'
|
||||
|
||||
# TestMain
|
||||
class TestMain < Minitest::Test
|
||||
def test_main
|
||||
assert_equal true, true
|
||||
assert_equal 0, main
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user