-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from datpmt/v.0.1.2
v.0.1.2 using gem typo_checker
- Loading branch information
Showing
13 changed files
with
145 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Configuration for Typocop - a GitHub Action for checking typos in pull requests | ||
|
||
# 'excludes' section allows you to specify files and folders to exclude | ||
# from the typo-checking process. You can list specific files or use glob | ||
# patterns to exclude entire directories. | ||
|
||
excludes: # Folders and files to exclude from typo checks | ||
# Example: Exclude a specific file (e.g., 'exclude.rb' in the 'excludes' folder) | ||
- excludes/exclude.rb | ||
# Example: Exclude all files in the 'test' folder inside the 'excludes' directory | ||
- excludes/test/* | ||
|
||
# 'skips' section defines a list of words, file names, or patterns | ||
# for which Typocop will skip checking for typos. This is useful for common | ||
# terms or abbreviations you don't want to be flagged as typos. | ||
|
||
skips: # Words or patterns to skip typo-checking | ||
- rspec | ||
# Example: Skip checking for the word 'elligible' (common in testing setups) | ||
- elligible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def greeting(name) | ||
puts "Hello, #{name}! Welocome to the Ruby typos test." | ||
puts 'languege' # typo | ||
puts 'knowlege' # typo | ||
puts 'knowlege: languege' # typo | ||
puts 'welcom' | ||
end | ||
|
||
greeting('Alice') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def greeting(name) | ||
puts "Hello, #{name}! Welocome to the Ruby typos test." | ||
puts 'languege' # typo | ||
puts 'knowlege' # typo | ||
puts 'knowlege: languege' # typo | ||
puts 'welcom' | ||
end | ||
|
||
greeting('Alice') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var languege = 'en' // typo | ||
console.log(languege) // typo | ||
console.log('welcom') // typo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
def greet(name): | ||
print(f"Hello, {name}! Welcome to Python programming.") | ||
|
||
def factorial(n): | ||
if n == 0 or n == 1: | ||
return 1 | ||
else: | ||
result = 1 | ||
for i in range(2, n + 1): | ||
result *= i | ||
return result | ||
|
||
numbers = [5, 3, 8, 10] | ||
|
||
for number in numbers: | ||
print(f"Factorial of {number} is: {factorial(number)}") | ||
|
||
user_name = input("Enter your name: ") | ||
|
||
greet(user_name) | ||
|
||
age = int(input("Enter your age: ")) | ||
if age >= 18: | ||
print("You are elligible for an adult privilege.") # typo | ||
else: | ||
print("You are underage, so no adult privileges for you.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
require 'thor' | ||
require_relative 'settings' | ||
|
||
module Typocop | ||
class CLI < Thor | ||
require 'typocop' | ||
method_option :config, type: :string, default: '.github/typocop/setting.yml', aliases: '-c', desc: 'Load setting.' | ||
|
||
desc 'execute', 'Run typocop' | ||
def execute | ||
Typocop.execute | ||
settings = Settings.new(options[:config]) | ||
Typocop.execute(settings) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'yaml' | ||
|
||
module Typocop | ||
class Settings | ||
attr_reader :excludes, :skips | ||
|
||
def initialize(setting_path) | ||
@settings = load_settings(setting_path) | ||
@excludes = @settings['excludes'] || [] | ||
@skips = @settings['skips'] || [] | ||
end | ||
|
||
private | ||
|
||
def load_settings(setting_path) | ||
begin | ||
YAML.load_file(setting_path) | ||
rescue StandardError => e | ||
puts "Error loading YAML file: #{e.message}" | ||
return {} | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Typocop | ||
VERSION = '0.1.2' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
require_relative 'lib/typocop/version' | ||
|
||
Gem::Specification.new do |s| | ||
s.name = 'typocop' | ||
s.version = '0.1.1' | ||
s.version = Typocop::VERSION | ||
s.summary = 'Comment on PRs with typos or approvals' | ||
s.description = "Typocop integrates with GitHub Actions to automatically comment on pull requests when typos are detected or when a PR is approved, based on [Crate CI's Typos](https://github.com/crate-ci/typos)." | ||
s.description = 'Typocop integrates with GitHub Actions to automatically comment on pull requests when typos are detected or when a PR is approved).' | ||
s.authors = ['datpmt'] | ||
s.email = '[email protected]' | ||
s.files = Dir['CHANGELOG.md', 'LICENSE', 'README.md', 'lib/**/*', 'bin/*'] | ||
|
@@ -16,6 +18,7 @@ Gem::Specification.new do |s| | |
s.add_dependency 'octokit', '9.2.0' | ||
s.add_dependency 'rugged', '~> 1.6.3' | ||
s.add_dependency 'thor', '~> 1.3.2' | ||
s.add_dependency 'typo_checker' | ||
s.executables = %w[typocop] | ||
s.files.each do |file| | ||
next unless file.start_with?('bin/') | ||
|