Skip to content

Commit 1c18722

Browse files
Merge pull request #1 from orise-robotics/first-version
First version
2 parents e878052 + 60b2c0f commit 1c18722

File tree

10 files changed

+3190
-1
lines changed

10 files changed

+3190
-1
lines changed

.devcontainer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"userEnvProbe": "loginInteractiveShell",
3+
"remoteUser": "$DOCKER_USER",
4+
"workspaceFolder": "$COLCON_WORKSPACE_FOLDER/ros2.code-workspace"
5+
}

.github/workflows/super_lint.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Super Lint
2+
on: [pull_request]
3+
jobs:
4+
super-lint:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: git checkout
8+
uses: actions/checkout@v2
9+
- name: super lint
10+
uses: github/super-linter@v3
11+
env:
12+
VALIDATE_ALL_CODEBASE: false
13+
DEFAULT_BRANCH: main
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
FILTER_REGEX_EXCLUDE: \.vscode-format\/.*

.vscode-format/ament_code_style.cfg

Lines changed: 2308 additions & 0 deletions
Large diffs are not rendered by default.

.vscode-format/ament_flake8.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
extend-ignore = C816,D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404,I202
3+
import-order-style = google
4+
max-line-length = 99
5+
show-source = true
6+
statistics = true

.vscode-format/cmake-format.py

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
# ----------------------------------
2+
# Options affecting listfile parsing
3+
# ----------------------------------
4+
with section("parse"):
5+
6+
# Specify structure for custom cmake functions
7+
additional_commands = { 'foo': { 'flags': ['BAR', 'BAZ'],
8+
'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}}
9+
10+
# Override configurations per-command where available
11+
override_spec = {}
12+
13+
# Specify variable tags.
14+
vartags = []
15+
16+
# Specify property tags.
17+
proptags = []
18+
19+
# -----------------------------
20+
# Options affecting formatting.
21+
# -----------------------------
22+
with section("format"):
23+
24+
# Disable formatting entirely, making cmake-format a no-op
25+
disable = False
26+
27+
# How wide to allow formatted cmake files
28+
line_width = 80
29+
30+
# How many spaces to tab for indent
31+
tab_size = 2
32+
33+
# If true, lines are indented using tab characters (utf-8 0x09) instead of
34+
# <tab_size> space characters (utf-8 0x20). In cases where the layout would
35+
# require a fractional tab character, the behavior of the fractional
36+
# indentation is governed by <fractional_tab_policy>
37+
use_tabchars = False
38+
39+
# If <use_tabchars> is True, then the value of this variable indicates how
40+
# fractional indentions are handled during whitespace replacement. If set to
41+
# 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set
42+
# to `round-up` fractional indentation is replaced with a single tab character
43+
# (utf-8 0x09) effectively shifting the column to the next tabstop
44+
fractional_tab_policy = 'use-space'
45+
46+
# If an argument group contains more than this many sub-groups (parg or kwarg
47+
# groups) then force it to a vertical layout.
48+
max_subgroups_hwrap = 2
49+
50+
# If a positional argument group contains more than this many arguments, then
51+
# force it to a vertical layout.
52+
max_pargs_hwrap = 2
53+
54+
# If a cmdline positional group consumes more than this many lines without
55+
# nesting, then invalidate the layout (and nest)
56+
max_rows_cmdline = 2
57+
58+
# If true, separate flow control names from their parentheses with a space
59+
separate_ctrl_name_with_space = False
60+
61+
# If true, separate function names from parentheses with a space
62+
separate_fn_name_with_space = False
63+
64+
# If a statement is wrapped to more than one line, than dangle the closing
65+
# parenthesis on its own line.
66+
dangle_parens = True
67+
68+
# If the trailing parenthesis must be 'dangled' on its on line, then align it
69+
# to this reference: `prefix`: the start of the statement, `prefix-indent`:
70+
# the start of the statement, plus one indentation level, `child`: align to
71+
# the column of the arguments
72+
dangle_align = 'prefix'
73+
74+
# If the statement spelling length (including space and parenthesis) is
75+
# smaller than this amount, then force reject nested layouts.
76+
min_prefix_chars = 4
77+
78+
# If the statement spelling length (including space and parenthesis) is larger
79+
# than the tab width by more than this amount, then force reject un-nested
80+
# layouts.
81+
max_prefix_chars = 10
82+
83+
# If a candidate layout is wrapped horizontally but it exceeds this many
84+
# lines, then reject the layout.
85+
max_lines_hwrap = 2
86+
87+
# What style line endings to use in the output.
88+
line_ending = 'unix'
89+
90+
# Format command names consistently as 'lower' or 'upper' case
91+
command_case = 'canonical'
92+
93+
# Format keywords consistently as 'lower' or 'upper' case
94+
keyword_case = 'unchanged'
95+
96+
# A list of command names which should always be wrapped
97+
always_wrap = []
98+
99+
# If true, the argument lists which are known to be sortable will be sorted
100+
# lexicographicall
101+
enable_sort = True
102+
103+
# If true, the parsers may infer whether or not an argument list is sortable
104+
# (without annotation).
105+
autosort = True
106+
107+
# By default, if cmake-format cannot successfully fit everything into the
108+
# desired linewidth it will apply the last, most agressive attempt that it
109+
# made. If this flag is True, however, cmake-format will print error, exit
110+
# with non-zero status code, and write-out nothing
111+
require_valid_layout = False
112+
113+
# A dictionary mapping layout nodes to a list of wrap decisions. See the
114+
# documentation for more information.
115+
layout_passes = {}
116+
117+
# ------------------------------------------------
118+
# Options affecting comment reflow and formatting.
119+
# ------------------------------------------------
120+
with section("markup"):
121+
122+
# What character to use for bulleted lists
123+
bullet_char = '*'
124+
125+
# What character to use as punctuation after numerals in an enumerated list
126+
enum_char = '.'
127+
128+
# If comment markup is enabled, don't reflow the first comment block in each
129+
# listfile. Use this to preserve formatting of your copyright/license
130+
# statements.
131+
first_comment_is_literal = False
132+
133+
# If comment markup is enabled, don't reflow any comment block which matches
134+
# this (regex) pattern. Default is `None` (disabled).
135+
literal_comment_pattern = None
136+
137+
# Regular expression to match preformat fences in comments default=
138+
# ``r'^\s*([`~]{3}[`~]*)(.*)$'``
139+
fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$'
140+
141+
# Regular expression to match rulers in comments default=
142+
# ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'``
143+
ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$'
144+
145+
# If a comment line matches starts with this pattern then it is explicitly a
146+
# trailing comment for the preceeding argument. Default is '#<'
147+
explicit_trailing_pattern = '#<'
148+
149+
# If a comment line starts with at least this many consecutive hash
150+
# characters, then don't lstrip() them off. This allows for lazy hash rulers
151+
# where the first hash char is not separated by space
152+
hashruler_min_length = 10
153+
154+
# If true, then insert a space between the first hash char and remaining hash
155+
# chars in a hash ruler, and normalize its length to fill the column
156+
canonicalize_hashrulers = True
157+
158+
# enable comment markup parsing and reflow
159+
enable_markup = True
160+
161+
# ----------------------------
162+
# Options affecting the linter
163+
# ----------------------------
164+
with section("lint"):
165+
166+
# a list of lint codes to disable
167+
disabled_codes = []
168+
169+
# regular expression pattern describing valid function names
170+
function_pattern = '[0-9a-z_]+'
171+
172+
# regular expression pattern describing valid macro names
173+
macro_pattern = '[0-9A-Z_]+'
174+
175+
# regular expression pattern describing valid names for variables with global
176+
# (cache) scope
177+
global_var_pattern = '[A-Z][0-9A-Z_]+'
178+
179+
# regular expression pattern describing valid names for variables with global
180+
# scope (but internal semantic)
181+
internal_var_pattern = '_[A-Z][0-9A-Z_]+'
182+
183+
# regular expression pattern describing valid names for variables with local
184+
# scope
185+
local_var_pattern = '[a-z][a-z0-9_]+'
186+
187+
# regular expression pattern describing valid names for privatedirectory
188+
# variables
189+
private_var_pattern = '_[0-9a-z_]+'
190+
191+
# regular expression pattern describing valid names for public directory
192+
# variables
193+
public_var_pattern = '[A-Z][0-9A-Z_]+'
194+
195+
# regular expression pattern describing valid names for function/macro
196+
# arguments and loop variables.
197+
argument_var_pattern = '[a-z][a-z0-9_]+'
198+
199+
# regular expression pattern describing valid names for keywords used in
200+
# functions or macros
201+
keyword_pattern = '[A-Z][0-9A-Z_]+'
202+
203+
# In the heuristic for C0201, how many conditionals to match within a loop in
204+
# before considering the loop a parser.
205+
max_conditionals_custom_parser = 2
206+
207+
# Require at least this many newlines between statements
208+
min_statement_spacing = 1
209+
210+
# Require no more than this many newlines between statements
211+
max_statement_spacing = 2
212+
max_returns = 6
213+
max_branches = 12
214+
max_arguments = 5
215+
max_localvars = 15
216+
max_statements = 50
217+
218+
# -------------------------------
219+
# Options affecting file encoding
220+
# -------------------------------
221+
with section("encode"):
222+
223+
# If true, emit the unicode byte-order mark (BOM) at the start of the file
224+
emit_byteorder_mark = False
225+
226+
# Specify the encoding of the input file. Defaults to utf-8
227+
input_encoding = 'utf-8'
228+
229+
# Specify the encoding of the output file. Defaults to utf-8. Note that cmake
230+
# only claims to support utf-8 so be careful when using anything else
231+
output_encoding = 'utf-8'
232+
233+
# -------------------------------------
234+
# Miscellaneous configurations options.
235+
# -------------------------------------
236+
with section("misc"):
237+
238+
# A dictionary containing any per-command configuration overrides. Currently
239+
# only `command_case` is supported.
240+
per_command = {}

.vscode-format/style.yapf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[style]
2+
based_on_style: pep8
3+
blank_line_before_nested_class_or_def: true
4+
column_limit: 99
5+
dedent_closing_brackets: true
6+
coalesce_brackets: true

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
11
# vscode_ros2_ws
2-
ORise Robotics' VSCode workspace
2+
3+
ORise Robotics' VSCode workspace. It provides a [.code-workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) configuration to be used inside a ros2 [ORise container](https://github.com/orise-robotics/ros_ws)
4+
5+
## How to setup
6+
7+
Basically, the workspace file requires the definition of an environment variabled called `COLCON_WORKSPACE_FOLDER`, which is assumed to be the place where the formatting configuration folder `.vscode-format` and the colcon base-folders (`build`, `install`, `log`) live.
8+
9+
To work with containers, this package provides the helper script `setup_workspace.sh`: it copies the `ros2.code-workspace` file and the `.vscode-format/` folder to inside the specified container, which is assumed to be running. It also creates a named remote container configuration file to allow attaching to the container as an specific user (`orise` by default).
10+
11+
Run `setup_workspace.sh --help` for more details about the script usage.
12+
13+
## Workspace features
14+
15+
Recommend convenient extensions, configure formatting and linting tools, and provide helper tasks and build/test/debug launchs.
16+
17+
### Formatting & linting configurations
18+
19+
The workspace try to offer full formatting and linting tools to accomplish the rules defined by [`ament_lint_common`](https://github.com/ament/ament_lint/tree/master/ament_lint_common)
20+
21+
- **Python:** compatible with [`amment_flake8`](https://github.com/ament/ament_lint/tree/master/ament_flake8) and [`ament_pep257`](https://github.com/ament/ament_lint/tree/master/ament_pep257) using tools like [`yapf`](https://github.com/google/yapf), [`isort`](https://pycqa.github.io/isort/), [`flake8`](https://flake8.pycqa.org/en/latest/)
22+
- **C++:** compatible with [`amment_uncrustify`](https://github.com/ament/ament_lint/tree/master/amment_uncrustify), [`amment_cpplint`](https://github.com/ament/ament_lint/tree/master/amment_cpplint), [`amment_cppcheck`](https://github.com/ament/ament_lint/tree/master/amment_cppcheck)
23+
- **CMake:** compatible with [`ament_lint_cmake`](https://github.com/ament/ament_lint/tree/master/ament_lint_cmake) using [`cmake-format`](https://marketplace.visualstudio.com/items?itemName=cheshirekow.cmake-format)
24+
- **XML:** compatible with [`ament_xml_lint`](https://github.com/ament/ament_lint/tree/master/ament_xml_lint)
25+
- **Yaml**
26+
27+
### Tasks & Launch
28+
29+
Adapt tasks and launchs from [athackst/vscode_ros2_workspace](https://github.com/athackst/vscode_ros2_workspace)

0 commit comments

Comments
 (0)