Skip to content

Commit d6e5b24

Browse files
Enable all cops
1 parent bc887cd commit d6e5b24

33 files changed

+184
-195
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto

.rubocop.yml

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,8 @@
1+
inherit_from: .rubocop_todo.yml
2+
13
AllCops:
24
TargetRubyVersion: 2.5
3-
DisabledByDefault: true
5+
DisabledByDefault: false
46

57
Metrics/LineLength:
6-
Enabled: true
78
Max: 140
8-
9-
Style/HashSyntax:
10-
Enabled: true
11-
12-
Style/StringLiterals:
13-
Enabled: true
14-
EnforcedStyle: single_quotes
15-
16-
Style/MultilineIfThen:
17-
Enabled: true
18-
19-
Style/MethodDefParentheses:
20-
Enabled: true
21-
22-
Style/BracesAroundHashParameters:
23-
Enabled: true
24-
25-
Layout/IndentationWidth:
26-
Enabled: true
27-
28-
Layout/Tab:
29-
Enabled: true
30-
31-
Layout/EmptyLines:
32-
Enabled: true
33-
34-
Layout/TrailingBlankLines:
35-
Enabled: true
36-
37-
Layout/TrailingWhitespace:
38-
Enabled: true
39-
40-
Layout/SpaceBeforeBlockBraces:
41-
Enabled: true
42-
43-
Layout/SpaceInsideBlockBraces:
44-
Enabled: true
45-
46-
Layout/SpaceInsideHashLiteralBraces:
47-
Enabled: true
48-
49-
Layout/CaseIndentation:
50-
Enabled: true
51-
52-
Layout/EndAlignment:
53-
Enabled: true
54-
EnforcedStyleAlignWith: variable

.rubocop_todo.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2018-04-08 15:14:25 +1200 using RuboCop version 0.54.0.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 1
10+
Metrics/AbcSize:
11+
Max: 19
12+
13+
# Offense count: 2
14+
# Configuration parameters: CountComments, ExcludedMethods.
15+
Metrics/BlockLength:
16+
Max: 32
17+
18+
# Offense count: 1
19+
Style/MixinUsage:
20+
Exclude:
21+
- 'exe/cpp_dependency_graph'

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"pathToBundler": "C:/tools/ruby25/bin/bundle.bat",
2525
"pathToRDebugIDE": "C:/tools/ruby25/bin/rdebug-ide.bat",
2626
"showDebuggerOutput": true,
27-
"args": ["visualise", "--root_dir", "../protobuf/src"]
27+
"args": ["visualise", "-r", "../TileDB", "-f", "dot"]
2828
},
2929
{
3030
"name": "Listen for rdebug-ide",

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
source 'https://rubygems.org'
44

5-
git_source(:github) { |repo_name| 'https://github.com/shreyasbharath/cpp_dependency_graph' }
5+
git_source(:github) { |_| 'https://github.com/shreyasbharath/cpp_dependency_graph' }
66

77
gemspec

Rakefile

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
require 'bundler/gem_tasks'
24
require 'rspec/core/rake_task'
35
require 'rubocop/rake_task'

TODO.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [ ] Create a github.io homepage
66
- [ ] Add interactive `html` or `svg` examples to homepage
77
- [ ] Add a [CONTRIBUTING.md](https://github.com/nayafia/contributing-template/blob/master/CONTRIBUTING-template.md)
8+
- [ ] Ruby gem docs
89
- [ ] Progress messages
910
- [ ] Progress bar?
1011
- [x] Allow user to specify a single component and the tool should print only that component
@@ -32,6 +33,8 @@
3233
- [ ] Visualisation
3334
- [ ] Highlight strongly coupled components (i.e. have lots of outgoing/incoming dependencies). How to visualise strongly coupled components?
3435
- [ ] Interface vs implementation coupling (interface is worse!). Highlighting interface vs implementation coupling between components on graph?
36+
- [ ] Hierarchy diagram for components with no cycles? (https://bl.ocks.org/mbostock/4339184)
37+
- [ ] Pack diagram for just visualising components (https://bl.ocks.org/mbostock/ca5b03a33affa4160321)
3538
- [ ] Look at using subgraphs of the dot/svg language to cluster component dependencies in the graph
3639
- [ ] Create a d3 donut graph with relative sizes of components in project? This'll probably show which components need to be further split up (something like this https://blog.kathyreid.id.au/2016/12/29/linux-australia-expense-breakdown-a-data-visualisation-in-d3-js/)
3740
- [ ] Node size - base it on how many source files (or lines of code) or how many connections going in/out of node?

bin/console

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env ruby
22

3+
# frozen_string_literal: true
4+
35
require 'bundler/setup'
46
require 'cpp_dependency_graph'
57

cpp_dependency_graph.gemspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
lib = File.expand_path('../lib', __FILE__)
3+
lib = File.expand_path('lib', __dir__)
44
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
55

66
require 'cpp_dependency_graph/version'
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
99
s.name = 'cpp_dependency_graph'
1010
s.version = CppDependencyGraph::VERSION
1111
s.authors = ['Shreyas Balakrishna']
12-
s.email = ['shreyasbharath@users.noreply.github.com>']
12+
s.email = ['shreyasbharath@gmail.com']
1313
s.summary = <<-SUMMARY
1414
CppDependencyGraph is a program that generates dependency visualisations (dot, d3.js) to study the architecture of C/C++ projects
1515
SUMMARY
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
1919
s.homepage = 'https://github.com/shreyasbharath/cpp_dependency_graph'
2020
s.licenses = ['MIT']
2121

22-
s.files = %x[git ls-files -z].split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } -
22+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } -
2323
%w[.rubocop.yml .travis.yml appveyor.yml]
2424
s.bindir = 'exe'
2525
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -39,6 +39,6 @@ Gem::Specification.new do |s|
3939
s.add_development_dependency 'rake', '~> 12.3'
4040
s.add_development_dependency 'rspec', '~> 3.7'
4141
s.add_development_dependency 'rubocop', '~> 0.54'
42-
s.add_development_dependency 'ruby-prof', '~> 0.17'
4342
s.add_development_dependency 'ruby-debug-ide', '~> 0.6'
43+
s.add_development_dependency 'ruby-prof', '~> 0.17'
4444
end

exe/cpp_dependency_graph

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env ruby
22

3+
# frozen_string_literal: true
4+
35
#--
46
# Copyright (c) 2018 Shreyas Balakrishna
57

@@ -53,12 +55,12 @@ DOCOPT
5355
begin
5456
args = Docopt.docopt(doc)
5557

56-
if (args['--version'])
58+
if args['--version']
5759
puts VERSION
5860
Kernel.exit(0)
5961
end
6062

61-
project_dir = args['--root_dir'].gsub(/\\/,'/')
63+
project_dir = args['--root_dir'].tr('\\', '/')
6264

6365
unless File.directory?(project_dir)
6466
puts('Not a valid project source directory')

0 commit comments

Comments
 (0)