phpcop 0.4.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e3d4d38c484bea2b33984349716824b4d6539d4
4
- data.tar.gz: ded7b85d0f430d9834361f8e959c89165ada3f72
3
+ metadata.gz: 21740e8e63f9fa63630ee1580dbe6cf00f586ff3
4
+ data.tar.gz: d6848133f0c897e3345092a37581af74f167eca4
5
5
  SHA512:
6
- metadata.gz: ce4756471d9fd32b1e5d002dd6f211700131bf047c6e88b8e248466a2ec38eeaf91401940c2a7441a776f670c86023c7d9b7edefe197bb75b5ca0b7fb49e9d1a
7
- data.tar.gz: 562fad8df27cf6d9236f7443586c15c46fb26ebe8e4518a612e63798f76a616622dd2158de0d91aea519aa0f726e53eb69ae52845749a7ac5e943cbb09bc35f2
6
+ metadata.gz: 03f7d41acbff8f04b9fa195984f53f25b8e95db12c46a4b0f61d2f2faf05a96f7205e8680b33f951cc707e5dc25e0c9b2c59d5be82ea4333ca970044531372c5
7
+ data.tar.gz: 9fd4a1bdbb2d10655fb82f15c10e52e179ba00137763b2ef872c512945cda728b6378db3c948c081719414083224a7a6406ab110fbd110ef13e90661b61fd5d8
data/config/default.yml CHANGED
@@ -1,13 +1,3 @@
1
- # Configuration for application
2
- php:
3
- # Precise PHP version
4
- version: 7
5
- # Precise convention used
6
- rules:
7
- - PSR-2
8
- # Precise framework used
9
- framework: zf-2
10
-
11
1
  AllCops:
12
2
  # Exclude:
13
3
  # - '**/'
data/lib/phpcop/cli.rb CHANGED
@@ -7,7 +7,7 @@ module PhpCop
7
7
  class CLI
8
8
  attr_reader :config_store
9
9
 
10
- MSG_END = '%s fichier traité. %s erreurs.'
10
+ MSG_END = '%s fichiers traités. %s erreurs.'
11
11
 
12
12
  def initialize
13
13
  @config_store = ConfigStore.new
@@ -16,7 +16,27 @@ module PhpCop
16
16
  # Run all files
17
17
  def run(_args = ARGV)
18
18
  runner = PhpCop::Runner.new(@config_store)
19
- puts format(MSG_END, runner.count_files, runner.count_errors)
19
+ puts format(MSG_END,
20
+ format_count(runner.count_files),
21
+ format_count(runner.count_errors))
22
+ end
23
+
24
+ private
25
+
26
+ def format_count(count)
27
+ i = 0
28
+ f = []
29
+ count.to_s.reverse.split('').each do |letter|
30
+ i += 1
31
+ f.push(letter)
32
+ i = add_space(f) if i == 3
33
+ end
34
+ f.join.to_s.reverse
35
+ end
36
+
37
+ def add_space(f)
38
+ f.push(' ')
39
+ 0
20
40
  end
21
41
  end
22
42
  end
@@ -18,13 +18,17 @@ module PhpCop
18
18
 
19
19
  def initialize
20
20
  @options = load_configuration(DEFAULT_CONF)
21
- @options ||= load_configuration(CUSTOMIZE_CONF)
21
+ override_configuration(File.join(Dir.pwd, CUSTOMIZE_CONF))
22
22
  end
23
23
 
24
24
  private
25
25
 
26
26
  def load_configuration(file)
27
- File.exist?(file) ? YAML.load(File.read(file)) : false
27
+ YAML.load(File.read(file))
28
+ end
29
+
30
+ def override_configuration(file)
31
+ @options = load_configuration(file) if File.exist?(file)
28
32
  end
29
33
  end
30
34
  end
@@ -29,14 +29,6 @@ module PhpCop
29
29
  return_an_error(@file, @line_number, 0) unless n_constant.eql? name
30
30
  end
31
31
  end
32
-
33
- def return_an_error(file, line, column)
34
- @errors += 1
35
- line += 1
36
- puts format(MSG_ALERT_FILE, file, line, column)
37
- puts MSG_ALERT_DESCRIB
38
- puts ''
39
- end
40
32
  end
41
33
  end
42
34
  end
@@ -30,14 +30,6 @@ module PhpCop
30
30
  return_an_error(@file, @line_number, 0) unless name_camel.eql? name
31
31
  end
32
32
  end
33
-
34
- def return_an_error(file, line, column)
35
- @errors += 1
36
- line += 1
37
- puts format(MSG_ALERT_FILE, file, line, column)
38
- puts MSG_ALERT_DESCRIB
39
- puts ''
40
- end
41
33
  end
42
34
  end
43
35
  end
@@ -8,6 +8,7 @@ module PhpCop
8
8
  attr_reader :errors
9
9
  # Display an error 'fichier.ext:line:column'
10
10
  MSG_ALERT_FILE = '%s:%s:%s'
11
+ MSG_ALERT_DESCRIB = ''
11
12
 
12
13
  def initialize(file, line, line_number)
13
14
  @count_open = 0
@@ -24,6 +25,8 @@ module PhpCop
24
25
  @errors += 1
25
26
  line += 1
26
27
  puts format(MSG_ALERT_FILE, file, line, column)
28
+ puts MSG_ALERT_DESCRIB
29
+ puts ''
27
30
  end
28
31
  end
29
32
  end
@@ -28,14 +28,6 @@ module PhpCop
28
28
  array = @line.split(/./)
29
29
  array.each_with_index { |c, index| index unless c.ascii_only? }
30
30
  end
31
-
32
- def return_an_error(file, line, column)
33
- @errors += 1
34
- line += 1
35
- puts format(MSG_ALERT_FILE, file, line, column)
36
- puts MSG_ALERT_DESCRIB
37
- puts ''
38
- end
39
31
  end
40
32
  end
41
33
  end
@@ -53,14 +53,6 @@ module PhpCop
53
53
  invalid: :replace,
54
54
  replace: '?').encode('UTF-8')
55
55
  end
56
-
57
- def return_an_error(file, line, column)
58
- @errors += 1
59
- line += 1
60
- puts format(MSG_ALERT_FILE, file, line, column)
61
- puts MSG_ALERT_DESCRIB
62
- puts ''
63
- end
64
56
  end
65
57
  end
66
58
  end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Phpcop
5
- VERSION = '0.4.3'
5
+ VERSION = '0.5.4'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phpcop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy VAILLANT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-25 00:00:00.000000000 Z
11
+ date: 2016-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport