simple-annotations 0.9.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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d62a412404c8d41cb4230098c827cba940e6362353a20dd02da71a40acb15f7
4
- data.tar.gz: 993681e8e609eec8994bc7d2083e0509d57d871ceb4ffa3692c458cded56cd75
3
+ metadata.gz: bb8dd5c29e7e0c93d2462675fdce3029c205cebce502703edcac597fe2786497
4
+ data.tar.gz: e2b68572f27da1eabc468250616455db8b6325299ec1daa01d7197cec3127f54
5
5
  SHA512:
6
- metadata.gz: fedf3e96c67d342b2aab34c89ebe0aa7aa433420fd4cb9d74abc1115fc06ed36aaf6d22f72b1b103eb0f9db1e9bdb29ac6cbe7976e240a369897653ab2cddcd6
7
- data.tar.gz: 51575e47217422cf4eb9aaa904a58ae3b80bcd8f4695d6fc12fdbb03c45e99b3874d68cc065f7e2a05070a9934bb7ff4b88a694db4ccb4a95c732841f4bffaef
6
+ metadata.gz: 4d0f0a2eaab17864cf63deeb7ab16dc19c0b95c5b6e2b85149a9b5a81efbf09a010441722b6fea57209705a57c6c4e4556ed37f06bd95c5b3f0a9a7dd22886f5
7
+ data.tar.gz: 9673641541d4389035e43a3ea4fa4ec9db9d50a190e6a49016bd125db8a496dff199bdef36c6bfddc5eaff95c7cc1fe6b414e9c4e4fee4821923bb8b8b562bda
@@ -0,0 +1,11 @@
1
+ annotate!
2
+ fields
3
+ hooks
4
+ included
5
+ method_added
6
+ method_missing
7
+ m2
8
+ m3
9
+ m4
10
+ m5
11
+ m6
@@ -0,0 +1,23 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 3.2.3
14
+ - name: Getting dependencies (Bundle)
15
+ run: |
16
+ gem install bundler -v 2.2.3
17
+ bundle install
18
+ - name: Running test Rspec
19
+ run: |
20
+ bundle exec rake
21
+ - name: Running CVE security audit
22
+ run: |
23
+ bundle exec rake audit
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,99 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
4
+
5
+
6
+ Gemspec/DevelopmentDependencies:
7
+ Exclude:
8
+ - 'simple-annotations.gemspec'
9
+
10
+ # Offense count: 1
11
+ # This cop supports safe autocorrection (--autocorrect).
12
+ # Configuration parameters: EnforcedStyle.
13
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
14
+ Layout/EmptyLinesAroundClassBody:
15
+ Exclude:
16
+ - 'lib/simple-annotations.rb'
17
+
18
+ # Offense count: 1
19
+ # This cop supports safe autocorrection (--autocorrect).
20
+ # Configuration parameters: AllowInHeredoc.
21
+ Layout/TrailingWhitespace:
22
+ Exclude:
23
+ - 'lib/simple-annotations.rb'
24
+
25
+ # Offense count: 2
26
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
27
+ Metrics/MethodLength:
28
+ Max: 11
29
+
30
+ # Offense count: 8
31
+ # Configuration parameters: AsciiConstants.
32
+ Naming/AsciiIdentifiers:
33
+ Exclude:
34
+ - 'sample/test.rb'
35
+ - 'samples/test.rb'
36
+
37
+ # Offense count: 1
38
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
39
+ # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
40
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
41
+ Naming/FileName:
42
+ Exclude:
43
+ - 'Rakefile.rb'
44
+ - 'spec/simple-annotations_spec.rb'
45
+ - 'lib/simple-annotations.rb'
46
+
47
+ # Offense count: 2
48
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
49
+ # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
50
+ Naming/MethodParameterName:
51
+ Exclude:
52
+ - 'lib/simple-annotations.rb'
53
+
54
+ # Offense count: 4
55
+ # Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns.
56
+ # SupportedStyles: snake_case, camelCase
57
+ Naming/VariableName:
58
+ Exclude:
59
+ - 'lib/simple-annotations.rb'
60
+ - 'samples/test.rb'
61
+
62
+ # Offense count: 2
63
+ # This cop supports safe autocorrection (--autocorrect).
64
+ Style/ClassMethods:
65
+ Exclude:
66
+ - 'lib/simple-annotations.rb'
67
+
68
+ # Offense count: 3
69
+ Style/ClassVars:
70
+ Exclude:
71
+ - 'lib/simple-annotations.rb'
72
+
73
+ # Offense count: 2
74
+ # This cop supports safe autocorrection (--autocorrect).
75
+ Style/ColonMethodDefinition:
76
+ Exclude:
77
+ - 'lib/simple-annotations.rb'
78
+
79
+ # Offense count: 5
80
+ # Configuration parameters: AllowedConstants.
81
+ Style/Documentation:
82
+ Exclude:
83
+ - 'spec/**/*'
84
+ - 'test/**/*'
85
+ - 'lib/simple-annotations.rb'
86
+ - 'samples/test.rb'
87
+
88
+ # Offense count: 1
89
+ # This cop supports unsafe autocorrection (--autocorrect-all).
90
+ # Configuration parameters: EnforcedStyle.
91
+ # SupportedStyles: always, always_true, never
92
+ Style/FrozenStringLiteralComment:
93
+ Exclude:
94
+ - 'samples/test.rb'
95
+
96
+ # Offense count: 1
97
+ Style/MissingRespondToMissing:
98
+ Exclude:
99
+ - 'lib/simple-annotations.rb'
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
+ # frozen_string_literal: true
1
2
 
2
-
3
- source 'https://artifactory-iva.si.francetelecom.fr/artifactory/api/gems/gemsproxy/'
3
+ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Romain GEORGES
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,137 @@
1
+ # Simple Annotations 4 Ruby
2
+
3
+ Simple method annotations like in java or Python methods decorators
4
+
5
+
6
+ ![GitHub](https://img.shields.io/github/license/Ultragreen/simple-annotations)
7
+
8
+ [![Documentation](https://img.shields.io/badge/docs-rubydoc.info-brightgreen)](https://rubydoc.info/gems/simple-annotations)
9
+ ![GitHub issues](https://img.shields.io/github/issues/Ultragreen/simple-annotations)
10
+ ![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/Ultragreen/simple-annotations)
11
+ ![GitHub top language](https://img.shields.io/github/languages/top/Ultragreen/simple-annotations)
12
+ ![GitHub milestones](https://img.shields.io/github/milestones/open/Ultragreen/simple-annotations)
13
+
14
+ ![Gem](https://img.shields.io/gem/dt/simple-annotations)
15
+ [![Gem Version](https://badge.fury.io/rb/sc4ry.svg)](https://badge.fury.io/rb/simple-annotations)
16
+ ![Twitter Follow](https://img.shields.io/twitter/follow/Ultragreen?style=social)
17
+ ![GitHub Org's stars](https://img.shields.io/github/stars/Ultragreen?style=social)
18
+ ![GitHub watchers](https://img.shields.io/github/watchers/Ultragreen/simple-annotations?style=social)
19
+
20
+
21
+ <noscript><a href="https://liberapay.com/ruydiaz/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></noscript>
22
+
23
+ ## Installation
24
+
25
+ Install it yourself as:
26
+
27
+ $ gem install carioca
28
+
29
+
30
+
31
+
32
+ ## Usage
33
+
34
+ ## Adding annotations to a class
35
+
36
+
37
+ ```ruby
38
+ require 'rubygems'
39
+ require 'simple-annotations'
40
+
41
+ class A
42
+ using AnnotationRefinement
43
+
44
+ annotate!
45
+
46
+ §test 'string'
47
+ def method
48
+ return annotations(__callee__)
49
+ end
50
+
51
+ end
52
+
53
+ anA = A.new
54
+ pp anA.method
55
+
56
+ ```
57
+
58
+ Display
59
+
60
+ ```
61
+ {:test=>"string"}
62
+ ```
63
+
64
+
65
+ ### Getting fields
66
+
67
+ ```ruby
68
+ require 'rubygems'
69
+ require 'simple-annotations'
70
+
71
+ class A
72
+ using AnnotationRefinement
73
+ annotate!
74
+
75
+ §foobar {:color => 'cyan' } # Hash
76
+ §test 1234 # Numeric
77
+ §foobar color: 'cyan' # Hash by double splat, like keyword
78
+ §testbar 10, {}, [], 'string' # Hybrid by splat
79
+ §barfoo # Boolean set true
80
+ §footest 'string' # String
81
+ def method
82
+ [...]
83
+ end
84
+
85
+ end
86
+
87
+ pp A.annotations[:method]
88
+
89
+ ```
90
+
91
+ Display
92
+
93
+ ```
94
+ {:test=>1234, :foobar=>{:color=>"cyan"}, :testbar=>[10, {}, [], "string"], :barfoo=>true, :footest=>"string"}
95
+ ```
96
+
97
+ ### Defining Hooks
98
+
99
+ Supporting 2 Hooks :
100
+
101
+ - §after
102
+ - §before
103
+
104
+ Like :
105
+
106
+ ```ruby
107
+ require 'rubygems'
108
+ require 'simple-annotations'
109
+
110
+ class A
111
+ using AnnotationRefinement
112
+
113
+ annotate!
114
+
115
+
116
+ §after -> { puts 'after' }
117
+ §before -> { puts 'before' }
118
+ def m1
119
+ puts 'test'
120
+ end
121
+
122
+
123
+ end
124
+
125
+
126
+
127
+ anA = A.new
128
+ anA.m1
129
+ ```
130
+
131
+ Display
132
+
133
+ ```
134
+ before
135
+ test
136
+ after
137
+ ```
data/Rakefile CHANGED
@@ -1,58 +1,61 @@
1
- require 'rubygems'
1
+ # frozen_string_literal: true
2
2
 
3
- require 'rspec'
4
- require 'rake'
5
- require "rake/clean"
6
- require "rubygems/package_task"
3
+ require 'bundler/gem_tasks'
7
4
  require 'rspec/core/rake_task'
8
- require 'yard'
9
- require 'yard/rake/yardoc_task.rb'
10
- require "rake/tasklib"
11
- require "roodi"
12
- require "roodi_task"
13
-
14
- require "bundler/gem_tasks"
15
-
16
-
17
- RoodiTask.new() do | t |
18
- t.patterns = %w(lib/**/*.rb)
19
- t.config = "coding_convention.yml"
20
- end
21
-
22
-
23
- CLEAN.include('*.tmp','*.old')
24
- CLOBBER.include('*.tmp', 'build/*','#*#')
5
+ require 'rubocop//rake_task'
25
6
 
7
+ require 'yard'
8
+ require 'yard/rake/yardoc_task'
26
9
 
27
- content = File::readlines(File.join(File.dirname(__FILE__), 'simple-annotations.gemspec')).join
28
- spec = eval(content)
10
+ require 'code_statistics'
29
11
 
30
- RSpec::Core::RakeTask.new('spec')
12
+ RuboCop::RakeTask.new
13
+ RSpec::Core::RakeTask.new(:spec)
31
14
 
15
+ task default: :spec
32
16
 
17
+ require 'version'
18
+ require 'rake/version_task'
19
+ Rake::VersionTask.new
33
20
 
34
21
  YARD::Rake::YardocTask.new do |t|
35
- t.files = [ 'lib/**/*.rb', '-', 'doc/**/*','spec/**/*_spec.rb']
36
- t.options += ['--title', "Gem Documentation"]
37
- t.options += ['-o', "yardoc"]
38
- t.options += ['-r', "doc/manual.rdoc"]
22
+ t.files = ['lib/**/*.rb', '-', 'doc/**/*', 'spec/**/*_spec.rb']
23
+ t.options += ['-o', 'yardoc']
39
24
  end
40
- YARD::Config.load_plugin('yard-rspec')
25
+ YARD::Config.load_plugin('yard-rspec')
41
26
 
42
27
  namespace :yardoc do
43
28
  task :clobber do
44
- rm_r "yardoc" rescue nil
45
- rm_r ".yardoc" rescue nil
29
+ begin
30
+ rm_r 'yardoc'
31
+ rescue StandardError
32
+ nil
33
+ end
34
+ begin
35
+ rm_r '.yardoc'
36
+ rescue StandardError
37
+ nil
38
+ end
39
+ begin
40
+ rm_r 'pkg'
41
+ rescue StandardError
42
+ nil
43
+ end
46
44
  end
47
45
  end
48
- task :clobber => "yardoc:clobber"
49
-
46
+ task clobber: 'yardoc:clobber'
50
47
 
51
- Gem::PackageTask.new(spec) do |pkg|
52
- pkg.need_tar = true
53
- pkg.need_zip = true
48
+ desc 'Run CVE security audit over bundle'
49
+ task :audit do
50
+ system('bundle audit')
54
51
  end
55
52
 
53
+ desc 'Run dead line of code detection'
54
+ task :debride do
55
+ system('debride -w .debride_whitelist .')
56
+ end
56
57
 
57
-
58
- task :default => [:gem]
58
+ desc 'Run SBOM CycloneDX Xml format file'
59
+ task :sbom do
60
+ system('cyclonedx-ruby -p .')
61
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0