pretty 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/pretty +10 -2
- metadata +2 -2
data/bin/pretty
CHANGED
@@ -19,11 +19,12 @@ else
|
|
19
19
|
|
20
20
|
#check for shebang
|
21
21
|
if file.readline[0..1] != "#!"
|
22
|
-
errors[err_cnt]
|
22
|
+
errors[err_cnt] = "#{filename}:#{ln_cnt}: No shebang found but it's not end of world ;-)"
|
23
23
|
err_cnt+=1
|
24
24
|
end
|
25
25
|
|
26
|
-
#now checking rest
|
26
|
+
#now checking for rest errors
|
27
|
+
file.rewind
|
27
28
|
file.each_line do |line|
|
28
29
|
ln_cnt+=1
|
29
30
|
if line.size > 80 #short lines are better to read
|
@@ -38,6 +39,11 @@ else
|
|
38
39
|
errors[err_cnt] = "#{filename}:#{ln_cnt}: Too many tabulations"
|
39
40
|
err_cnt+=1
|
40
41
|
end
|
42
|
+
if line =~ /[$]\w+/ #it's not good to use global variables
|
43
|
+
errors[err_cnt] = "#{filename}:#{ln_cnt}: It's not good to use global variables.\
|
44
|
+
\nIgnore it if you are using $_ or another special variable"
|
45
|
+
err_cnt+=1
|
46
|
+
end
|
41
47
|
end
|
42
48
|
|
43
49
|
file.close
|
@@ -48,6 +54,8 @@ else
|
|
48
54
|
#shows and save report
|
49
55
|
name = "report#{Time.now.to_i}.txt"
|
50
56
|
file = File.open(name,"w")
|
57
|
+
p "Found #{err_cnt} errors in #{ARGV.size} files"
|
58
|
+
if err_cnt == 0 : p "This is propably the best program in the world!" end
|
51
59
|
errors.each {|err| p err; file << (err+"\n")}
|
52
60
|
p "Report file: #{name}"
|
53
61
|
file.close
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz 'WujcioL' Tybura
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-12 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|