Skip to content

Commit

Permalink
Add RuboCop extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloboyle committed Aug 14, 2024
1 parent 4e3204a commit 8ba51fb
Show file tree
Hide file tree
Showing 8 changed files with 264 additions and 11 deletions.
230 changes: 230 additions & 0 deletions .robucop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
AllCops:
NewCops: enable
SuggestExtensions: true

# Enable the recommended extension libraries
require:
- rubocop-rspec
- rubocop-rake

# Gemspec specific cops
Gemspec/AddRuntimeDependency:
Enabled: true
Gemspec/DeprecatedAttributeAssignment:
Enabled: true
Gemspec/DevelopmentDependencies:
Enabled: true
Gemspec/RequireMFA:
Enabled: true

# Layout specific cops
Layout/LineContinuationLeadingSpace:
Enabled: true
Layout/LineContinuationSpacing:
Enabled: true
Layout/LineEndStringConcatenationIndentation:
Enabled: true
Layout/SpaceBeforeBrackets:
Enabled: true

# Lint specific cops
Lint/AmbiguousAssignment:
Enabled: true
Lint/AmbiguousOperatorPrecedence:
Enabled: true
Lint/AmbiguousRange:
Enabled: true
Lint/ConstantOverwrittenInRescue:
Enabled: true
Lint/DeprecatedConstants:
Enabled: true
Lint/DuplicateBranch:
Enabled: true
Lint/DuplicateMagicComment:
Enabled: true
Lint/DuplicateMatchPattern:
Enabled: true
Lint/DuplicateRegexpCharacterClassElement:
Enabled: true
Lint/EmptyBlock:
Enabled: true
Lint/EmptyClass:
Enabled: true
Lint/EmptyInPattern:
Enabled: true
Lint/IncompatibleIoSelectWithFiberScheduler:
Enabled: true
Lint/ItWithoutArgumentsInBlock:
Enabled: true
Lint/LambdaWithoutLiteralBlock:
Enabled: true
Lint/LiteralAssignmentInCondition:
Enabled: true
Lint/MixedCaseRange:
Enabled: true
Lint/NoReturnInBeginEndBlocks:
Enabled: true
Lint/NonAtomicFileOperation:
Enabled: true
Lint/NumberedParameterAssignment:
Enabled: true
Lint/OrAssignmentToConstant:
Enabled: true
Lint/RedundantDirGlobSort:
Enabled: true
Lint/RedundantRegexpQuantifiers:
Enabled: true
Lint/RefinementImportMethods:
Enabled: true
Lint/RequireRangeParentheses:
Enabled: true
Lint/RequireRelativeSelfPath:
Enabled: true
Lint/SymbolConversion:
Enabled: true
Lint/ToEnumArguments:
Enabled: true
Lint/TripleQuotes:
Enabled: true
Lint/UnexpectedBlockArity:
Enabled: true
Lint/UnmodifiedReduceAccumulator:
Enabled: true
Lint/UselessRescue:
Enabled: true
Lint/UselessRuby2Keywords:
Enabled: true

# Metrics specific cops
Metrics/CollectionLiteralLength:
Enabled: true

# Naming specific cops
Naming/BlockForwarding:
Enabled: true

# Security specific cops
Security/CompoundHash:
Enabled: true
Security/IoMethods:
Enabled: true

# Style specific cops
Style/ArgumentsForwarding:
Enabled: true
Style/ArrayIntersect:
Enabled: true
Style/CollectionCompact:
Enabled: true
Style/ComparableClamp:
Enabled: true
Style/ConcatArrayLiterals:
Enabled: true
Style/DataInheritance:
Enabled: true
Style/DirEmpty:
Enabled: true
Style/DocumentDynamicEvalDefinition:
Enabled: true
Style/EmptyHeredoc:
Enabled: true
Style/EndlessMethod:
Enabled: true
Style/EnvHome:
Enabled: true
Style/ExactRegexpMatch:
Enabled: true
Style/FetchEnvVar:
Enabled: true
Style/FileEmpty:
Enabled: true
Style/FileRead:
Enabled: true
Style/FileWrite:
Enabled: true
Style/HashConversion:
Enabled: true
Style/HashExcept:
Enabled: true
Style/IfWithBooleanLiteralBranches:
Enabled: true
Style/InPatternThen:
Enabled: true
Style/MagicCommentFormat:
Enabled: true
Style/MapCompactWithConditionalBlock:
Enabled: true
Style/MapIntoArray:
Enabled: true
Style/MapToHash:
Enabled: true
Style/MapToSet:
Enabled: true
Style/MinMaxComparison:
Enabled: true
Style/MultilineInPatternThen:
Enabled: true
Style/NegatedIfElseCondition:
Enabled: true
Style/NestedFileDirname:
Enabled: true
Style/NilLambda:
Enabled: true
Style/NumberedParameters:
Enabled: true
Style/NumberedParametersLimit:
Enabled: true
Style/ObjectThen:
Enabled: true
Style/OpenStructUse:
Enabled: true
Style/OperatorMethodCall:
Enabled: true
Style/QuotedSymbols:
Enabled: true
Style/RedundantArgument:
Enabled: true
Style/RedundantArrayConstructor:
Enabled: true
Style/RedundantConstantBase:
Enabled: true
Style/RedundantCurrentDirectoryInPath:
Enabled: true
Style/RedundantDoubleSplatHashBraces:
Enabled: true
Style/RedundantEach:
Enabled: true
Style/RedundantFilterChain:
Enabled: true
Style/RedundantHeredocDelimiterQuotes:
Enabled: true
Style/RedundantInitialize:
Enabled: true
Style/RedundantLineContinuation:
Enabled: true
Style/RedundantRegexpArgument:
Enabled: true
Style/RedundantRegexpConstructor:
Enabled: true
Style/RedundantSelfAssignmentBranch:
Enabled: true
Style/RedundantStringEscape:
Enabled: true
Style/ReturnNilInPredicateMethodDefinition:
Enabled: true
Style/SelectByRegexp:
Enabled: true
Style/SendWithLiteralMethodName:
Enabled: true
Style/SingleLineDoEndBlock:
Enabled: true
Style/StringChars:
Enabled: true
Style/SuperArguments:
Enabled: true
Style/SuperWithArgsParentheses:
Enabled: true
Style/SwapValues:
Enabled: true
Style/YAMLFileRead:
Enabled: true
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ gem "rake", "~> 13.0"

gem "rspec", "~> 3.0"

gem "rubocop", "~> 1.21"
group :development, :test do
gem "rubocop", require: false
gem "rubocop-rake", require: false
gem "rubocop-rspec", require: false
end
8 changes: 7 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.0)
parser (>= 3.3.1.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (3.0.4)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
strscan (3.1.0)
unicode-display_width (2.5.0)
Expand All @@ -58,7 +62,9 @@ DEPENDENCIES
obsidian_api!
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 1.21)
rubocop
rubocop-rake
rubocop-rspec

BUNDLED WITH
2.5.17
19 changes: 17 additions & 2 deletions lib/obsidian_api/note.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
# frozen_string_literal: true

# lib/obsidian_api/note.rb

module ObsidianAPI
# The Note class provides methods to interact with individual markdown notes in an Obsidian vault.
# It allows for reading, writing, and manipulating the content of the notes.
# It also provides methods to add and remove tags from notes.
#
# Example:
#
# vault = ObsidianAPI::Vault.new("path/to/vault")
# note = ObsidianAPI::Note.new(vault, "path/to/note.md")
#
# content = note.content
# puts content
#
# note.save("New content")
#
# note.add_tag("new-tag")
#
# note.remove_tag("old-tag")
class Note
attr_reader :vault, :file_path

Expand Down
3 changes: 2 additions & 1 deletion lib/obsidian_api/vault.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# frozen_string_literal: true

# lib/obsidian_api/vault.rb
module ObsidianAPI
# The Vault class provides methods to interact with the Obsidian vault as a whole.
# It allows listing files, reading their content, writing new content, and deleting files.
class Vault
attr_reader :path

Expand Down
Binary file modified obsidian_api-0.1.0.gem
Binary file not shown.
4 changes: 3 additions & 1 deletion obsidian_api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ Gem::Specification.new do |spec|
spec.email = ["[email protected]"]

spec.summary = "A Ruby gem for interacting with Obsidian vaults."
spec.description = "ObsidianAPI Gem provides an easy-to-use interface for managing Markdown files, metadata, and events within an Obsidian vault. Ideal for developers looking to automate tasks or integrate Obsidian with Ruby applications."
spec.description = "ObsidianAPI Gem provides an interface for managing Markdown files, metadata, and events"\
"within an Obsidian vault. Ideal for developers looking to automate tasks or integrate Obsidian " \
"with Ruby applications."
spec.homepage = "https://github.com/michaeloboyle/obsidian_api"
spec.license = "MIT"
spec.required_ruby_version = ">= 3.0.0"
Expand Down
5 changes: 0 additions & 5 deletions spec/obsidian_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,4 @@
it "has a version number" do
expect(ObsidianApi::VERSION).not_to be nil
end

it "does something useful" do
# Replace this with an actual useful test or remove the test
expect(true).to eq(true)
end
end

0 comments on commit 8ba51fb

Please sign in to comment.