Skip to content

Commit 84b213e

Browse files
[CI] Added Spell Checking to CI
Cleaned up the last necessary spelling mistakes in VPR so we can now add codespell to the CI. This will add spell-checking to the CI tests so when people merge code into VTR, we can ensure that there are no obvious spelling mistakes. I have added a config file which contains which files should be ignored and what words can be ignored.
1 parent 17bf401 commit 84b213e

File tree

8 files changed

+95
-16
lines changed

8 files changed

+95
-16
lines changed

.codespellrc

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[codespell]
2+
# These are a list of files that should skip spell-checking.
3+
skip = ./build,
4+
# File types that we do not need to spell-check.
5+
*.pdf,
6+
*.svg,
7+
*.log,
8+
# External projects that do not belong to us.
9+
./libs/EXTERNAL,
10+
./parmys,
11+
./abc,
12+
# Sub-projects which are not as maintained.
13+
./odin_ii,
14+
./ace2,
15+
./blifexplorer,
16+
./verilog_preprocessor,
17+
# WIP spelling cleanups.
18+
./vtr_flow,
19+
./utils/vqm2blif,
20+
# Temporary as we wait for some PRs to merge.
21+
*_graph_uxsdcxx_capnp.h,
22+
./vpr/src/route/rr_graph_generation/rr_graph.cpp,
23+
./vpr/src/route/rr_graph_generation/rr_graph2.cpp,
24+
25+
# Show a count of the number of spelling mistakes when codespell is run.
26+
count = true
27+
28+
# Only show critical information.
29+
quiet-level = 3
30+
31+
# Words to ignore for spell-checking. These are words that we know are spelled
32+
# correctly.
33+
ignore-words-list = subtile,
34+
subtiles,
35+
fle,
36+
EArch,
37+
FPT,
38+
Synopsys,
39+
inout,
40+
INOUT,
41+
Dout,
42+
dout,
43+
DATIN,
44+
ShowIn,
45+
# Special case: pres fac / pres cost for example.
46+
Pres,
47+
pres,
48+
# This is another special case. This happens due to string
49+
# formatting code "%shold". This can be fixed when std::format
50+
# is better supported in C++20.
51+
shold,

.github/workflows/lint.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
spelling:
12+
name: Check Spelling
13+
runs-on: ubuntu-24.04
14+
timeout-minutes: 5
15+
16+
steps:
17+
- name: Check out Git repository
18+
uses: actions/checkout@v5
19+
20+
- name: Install Requirements
21+
run: |
22+
python3 -m pip install --upgrade pip
23+
# NOTE: There is nothing special about this version. We just need to
24+
# fix it to something.
25+
pip install codespell==2.4.1
26+
27+
- name: Check Spelling
28+
run: codespell

libs/libarchfpga/src/vib_inf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct t_from_or_to_inf {
6060
struct t_first_stage_mux_inf {
6161
std::string mux_name;
6262
std::vector<std::vector<std::string>> from_tokens;
63-
std::vector<t_from_or_to_inf> froms;
63+
std::vector<t_from_or_to_inf> from_infos;
6464
};
6565

6666
struct t_second_stage_mux_inf : t_first_stage_mux_inf {

vpr/src/base/vib_grid/setup_vib_utils.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
static void process_from_or_to_tokens(const std::vector<std::string> tokens,
66
const std::vector<t_physical_tile_type>& physical_tile_types,
77
const std::vector<t_segment_inf> segments,
8-
std::vector<t_from_or_to_inf>& froms);
8+
std::vector<t_from_or_to_inf>& from_infos);
99

1010
static void parse_pin_name(const char* src_string,
1111
int* start_pin_index,
@@ -16,7 +16,7 @@ static void parse_pin_name(const char* src_string,
1616
static void process_from_or_to_tokens(const std::vector<std::string> tokens,
1717
const std::vector<t_physical_tile_type>& physical_tile_types,
1818
const std::vector<t_segment_inf> segments,
19-
std::vector<t_from_or_to_inf>& froms) {
19+
std::vector<t_from_or_to_inf>& from_infos) {
2020
for (int i_token = 0; i_token < (int)tokens.size(); i_token++) {
2121
std::string curr_token = tokens[i_token];
2222
const char* Token_char = curr_token.c_str();
@@ -25,7 +25,7 @@ static void process_from_or_to_tokens(const std::vector<std::string> tokens,
2525
t_from_or_to_inf from_inf;
2626
from_inf.type_name = splitted_tokens[0];
2727
from_inf.from_type = e_multistage_mux_from_or_to_type::MUX;
28-
froms.push_back(from_inf);
28+
from_infos.push_back(from_inf);
2929
} else if (splitted_tokens.size() == 2) {
3030
std::string from_type_name = splitted_tokens[0];
3131
e_multistage_mux_from_or_to_type from_type;
@@ -83,7 +83,7 @@ static void process_from_or_to_tokens(const std::vector<std::string> tokens,
8383
from_inf.from_type = from_type;
8484
from_inf.type_index = i_phy_type;
8585
from_inf.phy_pin_index = all_sub_tile_to_tile_pin_indices[i];
86-
froms.push_back(from_inf);
86+
from_infos.push_back(from_inf);
8787
}
8888
}
8989
}
@@ -102,7 +102,7 @@ static void process_from_or_to_tokens(const std::vector<std::string> tokens,
102102
from_inf.type_index = i_seg_type;
103103
from_inf.seg_dir = dir;
104104
from_inf.seg_index = seg_index;
105-
froms.push_back(from_inf);
105+
from_infos.push_back(from_inf);
106106
}
107107

108108
break;
@@ -217,7 +217,7 @@ void setup_vib_inf(const std::vector<t_physical_tile_type>& physical_tile_types,
217217
for (t_first_stage_mux_inf& first_stage : first_stages) {
218218
std::vector<std::vector<std::string>>& from_tokens = first_stage.from_tokens;
219219
for (const std::vector<std::string>& from_token : from_tokens) {
220-
process_from_or_to_tokens(from_token, physical_tile_types, segments, first_stage.froms);
220+
process_from_or_to_tokens(from_token, physical_tile_types, segments, first_stage.from_infos);
221221
}
222222
}
223223
vib_inf.set_first_stages(first_stages);
@@ -235,7 +235,7 @@ void setup_vib_inf(const std::vector<t_physical_tile_type>& physical_tile_types,
235235

236236
std::vector<std::vector<std::string>> from_tokens = second_stage.from_tokens;
237237
for (const std::vector<std::string>& from_token : from_tokens) {
238-
process_from_or_to_tokens(from_token, physical_tile_types, segments, second_stage.froms);
238+
process_from_or_to_tokens(from_token, physical_tile_types, segments, second_stage.from_infos);
239239
}
240240
}
241241
vib_inf.set_second_stages(second_stages);

vpr/src/draw/draw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ void init_draw_coords(float clb_width, const BlkLocRegistry& blk_loc_registry) {
508508
for (size_t x_loc = 0; x_loc < grid.width() - 1; x_loc++) {
509509
for (size_t y_loc = 0; y_loc < grid.height() - 1; y_loc++) {
510510

511-
// Get all chanx nodes at location (x_loc, y_loc), find largest ptc_num accross all nodes
511+
// Get all chanx nodes at location (x_loc, y_loc), find largest ptc_num across all nodes
512512
std::vector<RRNodeId> chanx_nodes = rr_graph.node_lookup().find_channel_nodes(layer, x_loc, y_loc, e_rr_type::CHANX);
513513
int max_chanx_ptc_num = 0;
514514
if (!chanx_nodes.empty()) {

vpr/src/draw/search_bar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ GdkEvent simulate_keypress(char key, GdkWindow* window) {
508508
* Correlation between key length and time is shaky; there might be some correlation to
509509
* how many strings are similar to it. All tests are performed with the key "1" - pretty common
510510
* Tests are searched three times then average
511-
* MODEL 1: EARCH + TSENG.BLIF
511+
* MODEL 1: EArch + TSENG.BLIF
512512
* NETS 1483
513513
* NET SRCH. 19392
514514
* BLOCKS 1835

vpr/src/route/rr_graph_generation/tileable_rr_graph/tileable_rr_graph_gsb.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,11 +1835,11 @@ t_vib_map build_vib_map(const RRGraphView& rr_graph,
18351835
VTR_ASSERT(vib->get_pbtype_name() == phy_type->name);
18361836
const std::vector<t_first_stage_mux_inf> first_stages = vib->get_first_stages();
18371837
for (size_t i_first_stage = 0; i_first_stage < first_stages.size(); i_first_stage++) {
1838-
std::vector<t_from_or_to_inf> froms = first_stages[i_first_stage].froms;
1838+
const std::vector<t_from_or_to_inf>& from_infos = first_stages[i_first_stage].from_infos;
18391839
RRNodeId to_node = rr_graph.node_lookup().find_node(layer, actual_coordinate.x(), actual_coordinate.y(), e_rr_type::MUX, i_first_stage);
18401840
VTR_ASSERT(to_node.is_valid());
18411841
VTR_ASSERT(rr_gsb.is_mux_node(to_node));
1842-
for (auto from : froms) {
1842+
for (auto from : from_infos) {
18431843
RRNodeId from_node;
18441844
if (from.from_type == e_multistage_mux_from_or_to_type::PB) {
18451845

@@ -1937,8 +1937,8 @@ t_vib_map build_vib_map(const RRGraphView& rr_graph,
19371937
/* Second stages*/
19381938
const std::vector<t_second_stage_mux_inf> second_stages = vib->get_second_stages();
19391939
for (size_t i_second_stage = 0; i_second_stage < second_stages.size(); i_second_stage++) {
1940-
std::vector<t_from_or_to_inf> froms = second_stages[i_second_stage].froms;
1941-
std::vector<t_from_or_to_inf> tos = second_stages[i_second_stage].to;
1940+
const std::vector<t_from_or_to_inf>& from_infos = second_stages[i_second_stage].from_infos;
1941+
const std::vector<t_from_or_to_inf>& tos = second_stages[i_second_stage].to;
19421942

19431943
std::vector<RRNodeId> to_nodes;
19441944
for (auto to : tos) {
@@ -2023,7 +2023,7 @@ t_vib_map build_vib_map(const RRGraphView& rr_graph,
20232023
}
20242024

20252025
std::vector<RRNodeId> from_nodes;
2026-
for (auto from : froms) {
2026+
for (auto from : from_infos) {
20272027
RRNodeId from_node;
20282028
if (from.from_type == e_multistage_mux_from_or_to_type::PB) {
20292029

vpr/src/route/rr_graph_generation/tileable_rr_graph/tileable_rr_graph_node_builder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static size_t estimate_num_mux_rr_nodes(const DeviceGrid& grids,
9393
size_t count = 0;
9494
for (size_t i_first_stage = 0; i_first_stage < vib->get_first_stages().size(); i_first_stage++) {
9595
auto first_stage = vib->get_first_stages()[i_first_stage];
96-
if (first_stage.froms.size() == 0) {
96+
if (first_stage.from_infos.size() == 0) {
9797
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
9898
"VIB first stage '%s' at (%d, %d) has no from!\n", first_stage.mux_name.c_str(), ix, iy);
9999
}

0 commit comments

Comments
 (0)