Skip to content

Commit 654a25c

Browse files
authored
Merge pull request #239 from noir-cr/dev
Release v0.12.2
2 parents 5349c7f + bfc2ed8 commit 654a25c

File tree

22 files changed

+567
-179
lines changed

22 files changed

+567
-179
lines changed

.ameba.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ignored_paths:
33

44
Metrics/CyclomaticComplexity:
55
Description: Disallows methods with a cyclomatic complexity higher than `MaxComplexity`
6-
MaxComplexity: 40
6+
MaxComplexity: 80
77
Enabled: true
88
Severity: Warning
99

.github/labeler.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
🔬 analyzer:
3+
- changed-files:
4+
- any-glob-to-any-file:
5+
- src/analyzer/**
6+
- src/models/analyzer.cr
7+
8+
💌 deliver:
9+
- changed-files:
10+
- any-glob-to-any-file:
11+
- src/deliver/**
12+
- src/models/deliver.cr
13+
14+
🔎 detector:
15+
- changed-files:
16+
- any-glob-to-any-file:
17+
- src/detector/**
18+
- src/models/detector.cr
19+
20+
🥢 mini-lexer:
21+
- changed-files:
22+
- any-glob-to-any-file:
23+
- src/minilexers/**
24+
- src/models/minilexer/**
25+
26+
📦 output-builder:
27+
- changed-files:
28+
- any-glob-to-any-file:
29+
- src/output_builder/**
30+
- src/models/output_builder.cr
31+
32+
💊 spec:
33+
- changed-files:
34+
- any-glob-to-any-file: spec/**
35+
36+
🦺 github-action:
37+
- changed-files:
38+
- any-glob-to-any-file: .github/workflows/**
39+
40+
📑 documentation:
41+
- changed-files:
42+
- any-glob-to-any-file: docs/**
43+
44+
⚙️ options:
45+
- changed-files:
46+
- any-glob-to-any-file: src/options.cr
47+
48+
🛥️ workflow:
49+
- changed-files:
50+
- any-glob-to-any-file:
51+
- .github/workflows/**
52+
- .github/labeler.yml

.github/workflows/ci.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Crystal CI
3+
on:
4+
pull_request:
5+
branches: [main, dev]
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
crystal-version: ['1.8.0', '1.9.0', '1.10.0', '1.11.0']
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: MeilCli/setup-crystal-action@v4
15+
with:
16+
crystal_version: ${{ matrix.crystal-version }}
17+
- name: Install dependencies
18+
run: shards install
19+
- name: Build
20+
run: shards build
21+
lint:
22+
runs-on: ubuntu-latest
23+
container:
24+
image: crystallang/crystal
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: Crystal Ameba Linter
28+
id: crystal-ameba
29+
uses: crystal-ameba/github-action@v0.8.0
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
tests:
33+
runs-on: ubuntu-latest
34+
container:
35+
image: crystallang/crystal
36+
steps:
37+
- uses: actions/checkout@v3
38+
- name: Install dependencies
39+
run: shards install
40+
- name: Run tests
41+
run: crystal spec

.github/workflows/crystal_build.yml

-20
This file was deleted.

.github/workflows/crystal_lint.yml

-21
This file was deleted.

.github/workflows/crystal_test.yml

-20
This file was deleted.

.github/workflows/labeler.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "Pull Request Labeler"
2+
on:
3+
- pull_request
4+
5+
jobs:
6+
labeler:
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/labeler@v5

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ Usage: noir <flags>
120120
--list-techs Show all technologies
121121
122122
Config:
123+
--config-file ./config.yaml Specify the path to a configuration file in YAML format
123124
--concurrency 100 Set concurrency
124125
125126
Others:

shard.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: noir
2-
version: 0.12.1
2+
version: 0.12.2
33

44
authors:
55
- hahwul <hahwul@gmail.com>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"title": "Gem Store API",
5+
"version": "1.0.0",
6+
"description": "Sample API for managing pets in a Gem store."
7+
},
8+
"paths": {
9+
"/gems_json": {
10+
"get": {
11+
"summary": "Get a list of pets"
12+
},
13+
"post": {
14+
"summary": "Add a new pet"
15+
},
16+
"parameters": [
17+
{
18+
"in": "query",
19+
"name": "query",
20+
"required": true,
21+
"schema": {
22+
"type": "string"
23+
}
24+
},
25+
{
26+
"in": "query",
27+
"name": "sort",
28+
"required": true,
29+
"schema": {
30+
"type": "string"
31+
}
32+
},
33+
{
34+
"in": "cookie",
35+
"name": "cookie",
36+
"required": true,
37+
"schema": {
38+
"type": "string"
39+
}
40+
}
41+
]
42+
}
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
openapi: 3.0.0
2+
info:
3+
title: Gem Store API
4+
version: 1.0.0
5+
description: Sample API for managing pets in a Gem store.
6+
paths:
7+
/gems_yml:
8+
get:
9+
summary: Get a list of pets
10+
put:
11+
summary: Add a new pet
12+
parameters:
13+
- in: query
14+
name: query
15+
required: true
16+
schema:
17+
type: string
18+
- in: query
19+
name: sort
20+
required: true
21+
schema:
22+
type: string
23+
- in: cookie
24+
name: cookie
25+
required: true
26+
schema:
27+
type: string

spec/functional_test/testers/oas3_spec.cr

+26
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,29 @@ FunctionalTester.new("fixtures/oas3/nil_cast/", {
3535
:techs => 1,
3636
:endpoints => 0,
3737
}, nil).test_all
38+
39+
FunctionalTester.new("fixtures/oas3/param_in_path/", {
40+
:techs => 1,
41+
:endpoints => 4,
42+
}, [
43+
Endpoint.new("/gems_yml", "GET", [
44+
Param.new("query", "", "query"),
45+
Param.new("sort", "", "query"),
46+
Param.new("cookie", "", "cookie"),
47+
]),
48+
Endpoint.new("/gems_yml", "PUT", [
49+
Param.new("query", "", "query"),
50+
Param.new("sort", "", "query"),
51+
Param.new("cookie", "", "cookie"),
52+
]),
53+
Endpoint.new("/gems_json", "GET", [
54+
Param.new("query", "", "query"),
55+
Param.new("sort", "", "query"),
56+
Param.new("cookie", "", "cookie"),
57+
]),
58+
Endpoint.new("/gems_json", "POST", [
59+
Param.new("query", "", "query"),
60+
Param.new("sort", "", "query"),
61+
Param.new("cookie", "", "cookie"),
62+
]),
63+
]).test_all

src/analyzer/analyzer.cr

+19-16
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,33 @@ require "./analyzers/*"
22
require "./analyzers/file_analyzers/*"
33

44
def initialize_analyzers(logger : NoirLogger)
5+
# Initializing analyzers
56
analyzers = {} of String => Proc(Hash(Symbol, String), Array(Endpoint))
6-
analyzers["ruby_rails"] = ->analyzer_ruby_rails(Hash(Symbol, String))
7-
analyzers["ruby_sinatra"] = ->analyzer_ruby_sinatra(Hash(Symbol, String))
8-
analyzers["ruby_hanami"] = ->analyzer_ruby_hanami(Hash(Symbol, String))
9-
analyzers["java_spring"] = ->analyzer_spring(Hash(Symbol, String))
10-
analyzers["kotlin_spring"] = ->analyzer_spring(Hash(Symbol, String))
11-
analyzers["java_armeria"] = ->analyzer_armeria(Hash(Symbol, String))
12-
analyzers["php_pure"] = ->analyzer_php_pure(Hash(Symbol, String))
7+
8+
# Mapping analyzers to their respective functions
9+
analyzers["c#-aspnet-mvc"] = ->analyzer_cs_aspnet_mvc(Hash(Symbol, String))
10+
analyzers["crystal_kemal"] = ->analyzer_crystal_kemal(Hash(Symbol, String))
11+
analyzers["crystal_lucky"] = ->analyzer_crystal_lucky(Hash(Symbol, String))
12+
analyzers["elixir_phoenix"] = ->analyzer_elixir_phoenix(Hash(Symbol, String))
1313
analyzers["go_echo"] = ->analyzer_go_echo(Hash(Symbol, String))
14-
analyzers["go_gin"] = ->analyzer_go_gin(Hash(Symbol, String))
1514
analyzers["go_fiber"] = ->analyzer_go_fiber(Hash(Symbol, String))
16-
analyzers["python_flask"] = ->analyzer_flask(Hash(Symbol, String))
17-
analyzers["python_fastapi"] = ->analyzer_fastapi(Hash(Symbol, String))
18-
analyzers["python_django"] = ->analyzer_django(Hash(Symbol, String))
15+
analyzers["go_gin"] = ->analyzer_go_gin(Hash(Symbol, String))
16+
analyzers["java_armeria"] = ->analyzer_armeria(Hash(Symbol, String))
17+
analyzers["java_jsp"] = ->analyzer_jsp(Hash(Symbol, String))
18+
analyzers["java_spring"] = ->analyzer_spring(Hash(Symbol, String))
1919
analyzers["js_express"] = ->analyzer_express(Hash(Symbol, String))
20-
analyzers["crystal_kemal"] = ->analyzer_crystal_kemal(Hash(Symbol, String))
21-
analyzers["crystal_lucky"] = ->analyzer_crystal_lucky(Hash(Symbol, String))
20+
analyzers["kotlin_spring"] = ->analyzer_spring(Hash(Symbol, String))
2221
analyzers["oas2"] = ->analyzer_oas2(Hash(Symbol, String))
2322
analyzers["oas3"] = ->analyzer_oas3(Hash(Symbol, String))
23+
analyzers["php_pure"] = ->analyzer_php_pure(Hash(Symbol, String))
24+
analyzers["python_django"] = ->analyzer_django(Hash(Symbol, String))
25+
analyzers["python_fastapi"] = ->analyzer_fastapi(Hash(Symbol, String))
26+
analyzers["python_flask"] = ->analyzer_flask(Hash(Symbol, String))
2427
analyzers["raml"] = ->analyzer_raml(Hash(Symbol, String))
25-
analyzers["java_jsp"] = ->analyzer_jsp(Hash(Symbol, String))
26-
analyzers["c#-aspnet-mvc"] = ->analyzer_cs_aspnet_mvc(Hash(Symbol, String))
28+
analyzers["ruby_hanami"] = ->analyzer_ruby_hanami(Hash(Symbol, String))
29+
analyzers["ruby_rails"] = ->analyzer_ruby_rails(Hash(Symbol, String))
30+
analyzers["ruby_sinatra"] = ->analyzer_ruby_sinatra(Hash(Symbol, String))
2731
analyzers["rust_axum"] = ->analyzer_rust_axum(Hash(Symbol, String))
28-
analyzers["elixir_phoenix"] = ->analyzer_elixir_phoenix(Hash(Symbol, String))
2932

3033
logger.info_sub "#{analyzers.size} Analyzers initialized"
3134
logger.debug "Analyzers:"

0 commit comments

Comments
 (0)