Skip to content

Commit 66789b8

Browse files
committed
Incorporated Rubocop changes. Added .rubocopy.yml and updated README.
Signed-off-by: Azeem Sajid <[email protected]>
1 parent 610c798 commit 66789b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1094
-946
lines changed

.rubocop.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
AllCops:
2+
NewCops: disable
3+
Include:
4+
- '**/*.rb'
5+
- '**/*.arb'
6+
- '**/*.gemfile'
7+
- '**/*.gemspec'
8+
- '**/*.rake'
9+
- '**/.simplecov'
10+
- '**/Gemfile'
11+
- '**/Guardfile'
12+
- '**/Rakefile'
13+
Exclude:
14+
- 'docs/**/*'
15+
- 'tmp/**/*'
16+
17+
Metrics/ClassLength:
18+
Enabled: false
19+
20+
Metrics/BlockLength:
21+
Enabled: false
22+
23+
Layout/LineLength:
24+
Enabled: false
25+
26+
Style/EmptyMethod:
27+
Enabled: false
28+
29+
Style/NumericLiterals:
30+
Enabled: false
31+
32+
Style/ClassAndModuleChildren:
33+
Enabled: false

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen-string-literal: true
2+
13
source 'http://rubygems.org'
24

35
# Use dependencies from .gemspec

Guardfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# frozen-string-literal: true
2+
13
# Guardfile for tests
24
# More info at https://github.com/guard/guard#readme
35

46
guard :test do
5-
watch(%r{^lib/(.+)\.so$}) { "test" }
6-
watch('test/test_helper.rb') { "test" }
7+
watch(%r{^lib/(.+)\.so$}) { 'test' }
8+
watch('test/test_helper.rb') { 'test' }
79
watch(%r{^test/.+_test\.rb$})
810
end

README.md

Lines changed: 73 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
taglib-ruby
2-
===========
1+
# taglib-ruby
32

43
Ruby interface for the [TagLib C++ library][taglib], for reading and
54
writing meta-data (tags) of many audio formats.
@@ -8,7 +7,7 @@ In contrast to other libraries, this one wraps the full C++ API, not
87
only the minimal C API. This means that all tag data can be accessed,
98
e.g. cover art of ID3v2 or custom fields of Ogg Vorbis comments.
109

11-
taglib-ruby currently supports the following:
10+
`taglib-ruby` currently supports the following:
1211

1312
* Reading/writing common tag data of all formats that TagLib supports
1413
* Reading/writing ID3v1 and ID3v2 including ID3v2.4 and Unicode
@@ -21,11 +20,10 @@ Contributions for more coverage of the library are very welcome.
2120
[![Gem version][gem-img]][gem-link]
2221
[![ci](https://github.com/robinst/taglib-ruby/workflows/ci/badge.svg)](https://github.com/robinst/taglib-ruby/actions?query=workflow%3Aci)
2322

24-
Installation
25-
------------
23+
## Installation
2624

27-
Before you install the gem, make sure to have [taglib 1.11.1 or higher][taglib] installed
28-
with header files (and a C++ compiler of course):
25+
Before you install the gem, make sure to have [taglib 1.11.1 or higher][taglib]
26+
installed with header files (and a C++ compiler of course):
2927

3028
* Debian/Ubuntu: `sudo apt-get install libtag1-dev`
3129
* Fedora/RHEL: `sudo dnf install taglib-devel`
@@ -34,107 +32,138 @@ with header files (and a C++ compiler of course):
3432

3533
Then do:
3634

37-
gem install taglib-ruby
35+
```shell
36+
gem install taglib-ruby
37+
```
3838

3939
### OS X C++ compiler override
4040

4141
Not all versions of TagLib get along with `clang++`, the default C++ compiler
4242
on OS X. To compile taglib-ruby's C++ extensions with a different compiler
4343
during installation, set the `TAGLIB_RUBY_CXX` environment variable.
4444

45-
TAGLIB_RUBY_CXX=g++-4.2 gem install taglib-ruby
45+
```shell
46+
TAGLIB_RUBY_CXX=g++-4.2 gem install taglib-ruby
47+
```
4648

47-
Usage
48-
-----
49+
## Usage
4950

5051
Complete API documentation can be found on
5152
[rubydoc.info](http://rubydoc.info/gems/taglib-ruby/frames).
5253

53-
Begin with the {TagLib} namespace.
54+
Begin with the `TagLib` namespace.
5455

55-
Release Notes
56-
-------------
56+
## Release Notes
5757

58-
See {file:CHANGELOG.md}.
58+
See [CHANGELOG.md](CHANGELOG.md).
5959

60-
Contributing
61-
------------
60+
## Contributing
6261

6362
### Dependencies
6463

6564
Fedora:
6665

67-
sudo dnf install taglib-devel ruby-devel gcc-c++ redhat-rpm-config swig
66+
```shell
67+
sudo dnf install taglib-devel ruby-devel gcc-c++ redhat-rpm-config swig
68+
```
6869

6970
### Building
7071

7172
Install dependencies (uses bundler, install it via `gem install bundler`
7273
if you don't have it):
7374

74-
bundle install
75+
```shell
76+
bundle install
77+
```
7578

76-
Regenerate SWIG wrappers if you made changes in `.i` files (use version 3.0.7 of SWIG - 3.0.8 through 3.0.12 will not work):
79+
Regenerate SWIG wrappers if you made changes in `.i` files (use version 3.0.7 of
80+
SWIG - 3.0.8 through 3.0.12 will not work):
7781

78-
rake swig
82+
```shell
83+
rake swig
84+
```
7985

8086
Force regeneration of all SWIG wrappers:
8187

82-
touch ext/*/*.i
83-
rake swig
88+
```shell
89+
touch ext/*/*.i
90+
rake swig
91+
```
8492

8593
Compile extensions:
8694

87-
rake clean compile
95+
```shell
96+
rake clean compile
97+
```
8898

8999
Run tests:
90100

91-
rake test
101+
```shell
102+
rake test
103+
```
92104

93105
Run irb with library:
94106

95-
irb -Ilib -rtaglib
107+
```shell
108+
irb -Ilib -rtaglib
109+
```
96110

97111
Build and install gem into system gems:
98112

99-
rake install
113+
```shell
114+
rake install
115+
```
100116

101117
Build a specific version of Taglib:
102118

103-
PLATFORM=x86_64-linux TAGLIB_VERSION=1.11.1 rake vendor
119+
```shell
120+
PLATFORM=x86_64-linux TAGLIB_VERSION=1.11.1 rake vendor
121+
```
104122

105-
The above command will automatically download Taglib 1.11.1, build it and install it in `tmp/x86_64-linux/taglib-1.11.1`.
123+
The above command will automatically download Taglib 1.11.1, build it and
124+
install it in `tmp/x86_64-linux/taglib-1.11.1`.
106125

107-
The `swig` and `compile` tasks can then be executed against that specific version of Taglib by setting the `TAGLIB_DIR` environment variable to `$PWD/tmp/x86_64-linux/taglib-1.11.1` (it is assumed that taglib headers are located at `$TAGLIB_DIR/include` and taglib libraries at `$TAGLIB_DIR/lib`).
126+
The `swig` and `compile` tasks can then be executed against that specific
127+
version of Taglib by setting the `TAGLIB_DIR` environment variable to
128+
`$PWD/tmp/x86_64-linux/taglib-1.11.1` (it is assumed that taglib headers are
129+
located at `$TAGLIB_DIR/include` and taglib libraries at `$TAGLIB_DIR/lib`).
108130

109-
The `test` task can then be run for that version of Taglib by adding `$PWD/tmp/x86_64-linux/taglib-1.11.1/lib` to the `LD_LIBRARY_PATH` environment variable.
131+
The `test` task can then be run for that version of Taglib by adding
132+
`$PWD/tmp/x86_64-linux/taglib-1.11.1/lib` to the `LD_LIBRARY_PATH` environment
133+
variable.
110134

111135
To do everything in one command:
112136

113-
PLATFORM=x86_64-linux TAGLIB_VERSION=1.11.1 TAGLIB_DIR=$PWD/tmp/x86_64-linux/taglib-1.11.1 LD_LIBRARY_PATH=$PWD/tmp/x86_64-linux/taglib-1.11.1/lib rake vendor compile test
137+
```shell
138+
PLATFORM=x86_64-linux TAGLIB_VERSION=1.11.1 TAGLIB_DIR=$PWD/tmp/x86_64-linux/taglib-1.11.1 LD_LIBRARY_PATH=$PWD/tmp/x86_64-linux/taglib-1.11.1/lib rake vendor compile test
139+
```
114140

115141
### Workflow
116142

117-
* Check out the latest main branch to make sure the feature hasn't been
118-
implemented or the bug hasn't been fixed yet
119-
* Check out the issue tracker to make sure someone already hasn't
120-
requested it and/or contributed it
121-
* Fork the project
122-
* Start a feature/bugfix branch
123-
* Commit and push until you are happy with your contribution
124-
* Make sure to add tests for it. This is important so I don't break it
143+
* Check out the latest `main` branch to make sure the feature hasn't been
144+
implemented or the bug hasn't been fixed yet.
145+
* Check out the issue tracker to make sure someone hasn't already
146+
requested it and/or contributed it.
147+
* Fork the project.
148+
* Start a feature/bugfix branch from `main`.
149+
* Commit and push until you are happy with your contribution.
150+
* Make sure to add tests for it. This is important so that I don't break it
125151
in a future version unintentionally.
152+
* Run `rubocop` locally to lint your changes and fix the issues. Please refer to
153+
[.rubocop.yml](.rubocop.yml) for the list of relaxed rules. Try to keep the
154+
liniting offenses to minimum. Preferably, first run `rubocop` on your fork to
155+
have a general idea of the existing linting offenses before writing new code.
126156
* Please try not to mess with the Rakefile, version, or history. If you
127157
want to have your own version, or is otherwise necessary, that is
128158
fine, but please isolate to its own commit so I can cherry-pick around
129159
it.
130160

131-
License
132-
-------
161+
## License
133162

134163
Copyright (c) 2010-2020 Robin Stocker and others, see Git history.
135164

136-
taglib-ruby is distributed under the MIT License,
137-
see LICENSE.txt for details.
165+
`taglib-ruby` is distributed under the MIT License, see
166+
[LICENSE.txt](LICENSE.txt) for details.
138167

139168
In the binary gem for Windows, a compiled [TagLib][taglib] is bundled as
140169
a DLL. TagLib is distributed under the GNU Lesser General Public License

Rakefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# encoding: utf-8
1+
# frozen-string-literal: true
22

33
require 'bundler/gem_tasks'
44
begin
55
Bundler.setup(:default, :development)
66
rescue Bundler::BundlerError => e
7-
$stderr.puts e.message
8-
$stderr.puts "Run `bundle install` to install missing gems"
7+
warn e.message
8+
warn 'Run `bundle install` to install missing gems'
99
exit e.status_code
1010
end
1111

@@ -15,7 +15,7 @@ Rake::TestTask.new(:test) do |test|
1515
test.pattern = 'test/**/*_test.rb'
1616
end
1717

18-
task :default => [:compile, :test]
18+
task default: %i[compile test]
1919

2020
require 'yard'
2121
YARD::Rake::YardocTask.new do |t|
@@ -30,7 +30,7 @@ import 'tasks/ext.rake'
3030
import 'tasks/gemspec_check.rake'
3131

3232
# When importing swig.rake, the *_wrap.cxx files depend on being generated
33-
# by Swig. Since the ExtensionTasks depend on the *_wrap.cxx files,
33+
# by Swig. Since the ExtensionTasks depend on the *_wrap.cxx files,
3434
# compiling the extensions will trigger Swig, which is not desired as
3535
# those files have already been generated and there's no reason to make
3636
# Swig a variable of the CI. The environment variable can be set to

docs/taglib/aiff.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# @since 0.7.0
22
module TagLib::RIFF::AIFF
3-
43
# The file class for `.aiff` files.
54
#
65
# @example Reading the title
@@ -58,7 +57,6 @@ def audio_properties
5857
# @since 1.0.0
5958
def id3v2_tag?
6059
end
61-
6260
end
6361

6462
class Properties < TagLib::AudioProperties
@@ -91,5 +89,4 @@ class Properties < TagLib::AudioProperties
9189
def aiff_c?
9290
end
9391
end
94-
9592
end

docs/taglib/base.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
# tag.title
4646
# # => "Title of the song"
4747
module TagLib
48-
4948
# Major version of TagLib the extensions were compiled against
5049
# (major.minor.patch). Note that the value is not actually 0, but
5150
# depends on the version of the installed library.
@@ -88,7 +87,6 @@ module TagLib
8887
# end
8988
#
9089
class FileRef
91-
9290
# Creates a new file and passes it to the provided block,
9391
# closing the file automatically at the end of the block.
9492
#
@@ -165,7 +163,6 @@ def close
165163

166164
# @abstract Base class for files, see subclasses.
167165
class File
168-
169166
# Save the file and the associated tags.
170167
#
171168
# See subclasses, as some provide more control over what is saved.
@@ -241,7 +238,6 @@ def empty?; end
241238

242239
# @abstract Base class for audio properties.
243240
class AudioProperties
244-
245241
Fast = 0
246242
Average = 1
247243
Accurate = 2

docs/taglib/flac.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# @since 0.5.0
22
module TagLib::FLAC
3-
43
# The file class for `.flac` files.
54
#
65
# Note that Xiph comments is the primary tagging format for FLAC files. When
@@ -30,7 +29,6 @@ module TagLib::FLAC
3029
# file.save
3130
# end
3231
class File < TagLib::File
33-
3432
NoTags = 0x0000
3533
XiphComment = 0x0001
3634
ID3v1 = 0x0002
@@ -183,7 +181,7 @@ class Picture
183181
BandLogo = 0x13
184182
PublisherLogo = 0x14
185183

186-
def initialize()
184+
def initialize
187185
end
188186

189187
# Type of the picture, see constants.

docs/taglib/id3v2.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class AttachedPictureFrame < Frame
223223
BandLogo = 0x13
224224
PublisherLogo = 0x14
225225

226-
def initialize()
226+
def initialize
227227
end
228228

229229
# @return [String]

0 commit comments

Comments
 (0)