roger_scsslint 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MzVhMDZlZTEwMTM5NmM3YzVkZGI0MTNlMjg0MmFiODI2MzQyOTRkNw==
5
- data.tar.gz: !binary |-
6
- MmMwYTFlZmE1ZjBlY2I2MGNkNGM4ZmQ2NDdkYWExNjc5ZjI5YWYzNA==
2
+ SHA1:
3
+ metadata.gz: 7403a3fed85f817b3c0aa9ec3a579894cacb93e4
4
+ data.tar.gz: 29cbca5e2e12484212f6944ab2d6fb5334d0d9a9
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NzY5N2NmNzUyMjkyYjkzMTBkNTdhNDdmMTU1YzA1YWZlYWQwZWQwMTIyODlj
10
- NDM4OWRmZWExMjNiOTQxMDIyYThlYjE1YTNhNjg0ODFmZGJhMmY3MzdkYjAz
11
- ZjI4OTYyODA1YTA4YzdlMTA3YzFlMzYzMDJjMTQyODAwODdiOGM=
12
- data.tar.gz: !binary |-
13
- YWI2OTI3NzVkMTViNzE2MGEzMGU4Yjg0OTQxMWE2MzNkN2FmNGI4YmVmZWMw
14
- OGU3YTQyZThlZDA1ODgzMTVmZGI2YTUxNGUzNzk1YWQ4ZWYwOGVkNTcxYzU0
15
- YWQzMWJiZGNhM2E5ODVmODI4OGMxNWM5NmM1YmQxNTZjOTIwYjQ=
6
+ metadata.gz: 25d6e7e8d86cb86ff8dac0b661854469732046bc75f9caa0748b988768c03cae78c4761c69cdb16bb1869d9e0a75a95863f16615f4588e5ec4516af7cb02aeff
7
+ data.tar.gz: 596cd28ca8bbeb690db2065aa51c7128069bdf8a559bce9b6c01028edd668aa26924b493cf4548d8b6b9bdff2a282a0afc1735f8ef5c247a22dae15ade9b2cb9
data/.rubocop.yml CHANGED
@@ -1,6 +1,15 @@
1
1
  LineLength:
2
2
  Max: 100
3
3
 
4
- Style/HashSyntax:
5
- Enabled:
6
- False
4
+ StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+ Enabled: true
7
+
8
+ Style/DotPosition:
9
+ EnforcedStyle: trailing
10
+ Enabled: true
11
+
12
+ # By default, the rails cops are not run. Override in project or home
13
+ # directory .rubocop.yml files, or by giving the -R/--rails option.
14
+ AllCops:
15
+ RunRailsCops: false
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
data/Rakefile CHANGED
@@ -1,15 +1,15 @@
1
- require 'rake/testtask'
2
- require 'rubocop/rake_task'
1
+ require "rake/testtask"
2
+ require "rubocop/rake_task"
3
3
 
4
- task :default => [:test, :rubocop]
4
+ task default: [:test, :rubocop]
5
5
 
6
- desc 'Run rubocop'
6
+ desc "Run rubocop"
7
7
  task :rubocop do
8
8
  RuboCop::RakeTask.new
9
9
  end
10
10
 
11
11
  Rake::TestTask.new do |t|
12
- t.libs << 'test'
13
- t.test_files = FileList['test/**/*_test.rb']
12
+ t.libs << "test"
13
+ t.test_files = FileList["test/**/*_test.rb"]
14
14
  t.verbose = true
15
15
  end
@@ -1,5 +1,5 @@
1
1
  # Roger Scss linting plugin
2
2
  module RogerScssLint; end
3
3
 
4
- require File.dirname(__FILE__) + '/roger_scsslint/lint'
5
- require File.dirname(__FILE__) + '/roger_scsslint/generator'
4
+ require File.dirname(__FILE__) + "/roger_scsslint/lint"
5
+ require File.dirname(__FILE__) + "/roger_scsslint/generator"
@@ -1,4 +1,4 @@
1
- require 'open-uri'
1
+ require "open-uri"
2
2
 
3
3
  # <- hekje
4
4
  module Roger
@@ -6,22 +6,23 @@ module Roger
6
6
  module Cli; end
7
7
  end
8
8
 
9
- require 'roger/cli/generate'
10
- require 'roger/cli/command'
11
- require 'roger/generators'
9
+ require "roger/cli/generate"
10
+ require "roger/cli/command"
11
+ require "roger/generators"
12
12
 
13
13
  module RogerScsslint
14
14
  # Lint configuration retriever
15
15
  class Generator < Roger::Generators::Base
16
16
  include Thor::Actions
17
- CONFIG_PATH = '.scss-lint.yml'
18
- DEFAULT_CONFIG_URL = 'https://raw.githubusercontent.com/DigitPaint/css/master/linters/.scss-lint.yml'
17
+ CONFIG_PATH = ".scss-lint.yml"
18
+ DEFAULT_CONFIG_URL = "https://raw.githubusercontent.com/" \
19
+ "DigitPaint/css/master/linters/.scss-lint.yml"
19
20
 
20
- desc 'Scsslint generator creates an .scss-lint.yml config file'
21
+ desc "Scsslint generator creates an .scss-lint.yml config file"
21
22
  class_option(
22
23
  :config,
23
24
  type: :string,
24
- aliases: ['-c'],
25
+ aliases: ["-c"],
25
26
  desc: "Optional config file to use takes a path or url, by
26
27
  default it uses the company' default"
27
28
  )
@@ -29,8 +30,8 @@ module RogerScsslint
29
30
  class_option(
30
31
  :force,
31
32
  type: :boolean,
32
- aliases: ['-f'],
33
- desc: 'Always overwrite the config file'
33
+ aliases: ["-f"],
34
+ desc: "Always overwrite the config file"
34
35
  )
35
36
 
36
37
  # Write config file
@@ -1,49 +1,27 @@
1
- require 'roger/test'
2
- require 'scss_lint'
3
- require 'scss_lint/cli'
4
- require 'scss_lint/runner'
1
+ require "roger/test"
2
+ require "scss_lint"
3
+ require "scss_lint/cli"
4
+ require "scss_lint/runner"
5
5
 
6
6
  module RogerScsslint
7
7
  # SCSS linter plugin for Roger
8
8
  class Lint
9
9
  # Configurability is the root of all evil
10
10
  # http://fishshell.com/docs/current/design.html#conf
11
- def initialize(_options = {})
11
+ def initialize(*)
12
+ @command = "scss-lint"
12
13
  end
13
14
 
14
- # access scss-lint methods to do printing ourselves
15
- def modify_scsslint_cli
16
- def @cli.setup_configuration_public(*args)
17
- setup_configuration(*args)
18
- end
19
- def @cli.scan_for_lints_public(*args)
20
- scan_for_lints(*args)
21
- end
22
- def @cli.files_to_lint_public(*args)
23
- files_to_lint(*args)
24
- end
25
- end
26
-
27
- def lint_report(test, runner)
28
- runner.lints.sort_by { |l| [l.filename, l.location] }.map do |lint|
29
- test.log(self, (lint.error? ? '[E]' : '[W]') +
30
- " #{lint.filename}:#{lint.location.line} #{lint.linter.name}: #{lint.description}")
31
- end
15
+ def detect_scsslint
16
+ command = [@command, "-v", ">/dev/null"]
17
+ detect = system(Shellwords.join(command))
18
+ fail "Could not find linter. Linter should be in Gemfile. " unless detect
32
19
  end
33
20
 
34
21
  def call(test, _options)
35
- test.log(self, 'SCSS linting files')
36
-
37
- @cli = SCSSLint::CLI.new
38
- modify_scsslint_cli
39
- linteroptions = SCSSLint::Options.new.parse([])
40
- linterconfig = @cli.setup_configuration_public(linteroptions)
41
-
42
- @cli.files_to_lint_public(linteroptions, linterconfig).each do |file|
43
- runner = SCSSLint::Runner.new(linterconfig)
44
- runner.run [file]
45
- lint_report(test, runner)
46
- end
22
+ detect_scsslint
23
+ test.log(self, "SCSS linting files")
24
+ system(@command)
47
25
  end
48
26
  end
49
27
  end
@@ -1,30 +1,30 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.authors = ['Hans Krutzer', 'Flurin Egger']
5
- s.email = ['info@digitpaint.nl', 'hans@digitpaint.nl', 'flurin@digitpaint.nl']
6
- s.name = 'roger_scsslint'
7
- s.version = '0.1.0'
8
- s.homepage = 'https://github.com/hkrutzer/roger_scsslint'
4
+ s.authors = ["Hans Krutzer", "Flurin Egger"]
5
+ s.email = ["info@digitpaint.nl", "hans@digitpaint.nl", "flurin@digitpaint.nl"]
6
+ s.name = "roger_scsslint"
7
+ s.version = "1.0.0"
8
+ s.homepage = "https://github.com/hkrutzer/roger_scsslint"
9
9
 
10
- s.summary = 'Lint SCSS files within Roger'
10
+ s.summary = "Lint SCSS files within Roger"
11
11
  s.description = <<-EOF
12
12
  Lint SCSS files within Roger, using scss-lint.
13
13
  Will use .scss-lint.yml.
14
14
  EOF
15
- s.licenses = ['MIT']
15
+ s.licenses = ["MIT"]
16
16
 
17
- s.date = Time.now.strftime('%Y-%m-%d')
17
+ s.date = Time.now.strftime("%Y-%m-%d")
18
18
 
19
19
  s.files = `git ls-files`.split("\n")
20
- s.require_paths = ['lib']
20
+ s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency 'roger', '~> 0.13', '>= 0.13.0'
23
- s.add_dependency 'scss-lint', '~> 0.31', '>= 0.31.0'
22
+ s.add_dependency "roger", "~> 0.13", ">= 0.13.0"
23
+ s.add_dependency "scss-lint", "~> 0.31", ">= 0.31.0"
24
24
 
25
- s.add_development_dependency 'rubocop', ['~> 0']
26
- s.add_development_dependency 'rake', ['~> 0']
27
- s.add_development_dependency 'test-unit', ['>= 0']
28
- s.add_development_dependency 'thor', ['~> 0']
29
- s.add_development_dependency 'mocha', ['~> 1.1.0']
25
+ s.add_development_dependency "rubocop", ["~> 0"]
26
+ s.add_development_dependency "rake", ["~> 0"]
27
+ s.add_development_dependency "test-unit", [">= 0"]
28
+ s.add_development_dependency "thor", ["~> 0"]
29
+ s.add_development_dependency "mocha", ["~> 1.1.0"]
30
30
  end
@@ -1,13 +1,13 @@
1
- require 'test/unit'
2
- require 'mocha/test_unit'
1
+ require "test/unit"
2
+ require "mocha/test_unit"
3
3
 
4
- require 'roger/cli'
5
- require_relative '../lib/roger_scsslint/generator.rb'
4
+ require "roger/cli"
5
+ require_relative "../lib/roger_scsslint/generator.rb"
6
6
 
7
7
  # Mock project
8
8
  class Project
9
9
  def path
10
- './'
10
+ "./"
11
11
  end
12
12
  end
13
13
 
@@ -15,15 +15,15 @@ end
15
15
  class GeneratorTest < Test::Unit::TestCase
16
16
  # Check if tasks is added
17
17
  def test_default_generator
18
- assert_includes Roger::Cli::Generate.tasks, 'rogerscsslint::', 'Scsslint task is loaded'
18
+ assert_includes Roger::Cli::Generate.tasks, "rogerscsslint::", "Scsslint task is loaded"
19
19
  end
20
20
 
21
21
  def test_create_file
22
- file_name = './.scss-lint.yml'
22
+ file_name = "./.scss-lint.yml"
23
23
  Roger::Cli::Base.expects(:project).once.returns(Project.new)
24
24
  cli = Roger::Cli::Generate.new
25
- cli.invoke 'rogerscsslint::', [], ['-f']
26
- assert File.exist?(file_name), 'After invoking the file is written'
25
+ cli.invoke "rogerscsslint::", [], ["-f"]
26
+ assert File.exist?(file_name), "After invoking the file is written"
27
27
 
28
28
  # Unlink file
29
29
  File.unlink file_name
data/test/lint_test.rb CHANGED
@@ -1,5 +1,5 @@
1
- require_relative '../lib/roger_scsslint/lint.rb'
2
- require 'test/unit'
1
+ require_relative "../lib/roger_scsslint/lint.rb"
2
+ require "test/unit"
3
3
 
4
4
  # Fake tester to pass into the linter plugin
5
5
  class TesterStub
@@ -17,9 +17,9 @@ end
17
17
  # Linting plugin unit test
18
18
  class LintTest < Test::Unit::TestCase
19
19
  def setup
20
- @file_name = '.scss-lint.yml'
21
- assert !File.exist?(@file_name), '.scss-lint.yml file already exists.'
22
- FileUtils.cp('./test/data/sample-scss-lint.yml', './.scss-lint.yml')
20
+ @file_name = ".scss-lint.yml"
21
+ assert !File.exist?(@file_name), ".scss-lint.yml file already exists."
22
+ FileUtils.cp("./test/data/sample-scss-lint.yml", "./.scss-lint.yml")
23
23
  end
24
24
 
25
25
  def test_lint
@@ -28,13 +28,8 @@ class LintTest < Test::Unit::TestCase
28
28
  linter = RogerScsslint::Lint.new
29
29
  linter.call(faketester, {})
30
30
 
31
- testfile = 'test/data/test.scss'
32
31
  assert_equal(faketester.messages,
33
- ['SCSS linting files',
34
- "[W] #{testfile}:1 SingleLinePerSelector: Each selector "\
35
- 'in a comma sequence should be on its own line',
36
- "[W] #{testfile}:2 ZeroUnit: `0px` should be written without units as `0`",
37
- "[W] #{testfile}:3 FinalNewline: Files should end with a trailing newline"])
32
+ ["SCSS linting files"])
38
33
  end
39
34
 
40
35
  def teardown
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roger_scsslint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hans Krutzer
@@ -9,119 +9,121 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-28 00:00:00.000000000 Z
12
+ date: 2015-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: roger
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0.13'
21
- - - ! '>='
21
+ - - ">="
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.13.0
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - ~>
28
+ - - "~>"
29
29
  - !ruby/object:Gem::Version
30
30
  version: '0.13'
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.13.0
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: scss-lint
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.31'
41
- - - ! '>='
41
+ - - ">="
42
42
  - !ruby/object:Gem::Version
43
43
  version: 0.31.0
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - ~>
48
+ - - "~>"
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0.31'
51
- - - ! '>='
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: 0.31.0
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: rubocop
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ~>
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ~>
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: rake
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ~>
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  type: :development
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ~>
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: test-unit
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ! '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ! '>='
93
+ - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: thor
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ~>
100
+ - - "~>"
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ~>
107
+ - - "~>"
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: mocha
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ~>
114
+ - - "~>"
115
115
  - !ruby/object:Gem::Version
116
116
  version: 1.1.0
117
117
  type: :development
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - ~>
121
+ - - "~>"
122
122
  - !ruby/object:Gem::Version
123
123
  version: 1.1.0
124
- description: ! " Lint SCSS files within Roger, using scss-lint.\n Will use .scss-lint.yml.\n"
124
+ description: |2
125
+ Lint SCSS files within Roger, using scss-lint.
126
+ Will use .scss-lint.yml.
125
127
  email:
126
128
  - info@digitpaint.nl
127
129
  - hans@digitpaint.nl
@@ -130,9 +132,9 @@ executables: []
130
132
  extensions: []
131
133
  extra_rdoc_files: []
132
134
  files:
133
- - .gitignore
134
- - .rubocop.yml
135
- - .travis.yml
135
+ - ".gitignore"
136
+ - ".rubocop.yml"
137
+ - ".travis.yml"
136
138
  - Gemfile
137
139
  - LICENSE
138
140
  - README.md
@@ -155,17 +157,17 @@ require_paths:
155
157
  - lib
156
158
  required_ruby_version: !ruby/object:Gem::Requirement
157
159
  requirements:
158
- - - ! '>='
160
+ - - ">="
159
161
  - !ruby/object:Gem::Version
160
162
  version: '0'
161
163
  required_rubygems_version: !ruby/object:Gem::Requirement
162
164
  requirements:
163
- - - ! '>='
165
+ - - ">="
164
166
  - !ruby/object:Gem::Version
165
167
  version: '0'
166
168
  requirements: []
167
169
  rubyforge_project:
168
- rubygems_version: 2.1.5
170
+ rubygems_version: 2.2.2
169
171
  signing_key:
170
172
  specification_version: 4
171
173
  summary: Lint SCSS files within Roger