Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 120
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Add git commit hashes to ignore for blame
7032e318260581fa759df467ce6638333fb6b108
16 changes: 16 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Code style checks

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- name: Install cppcheck
run: sudo apt install cppcheck -y
- uses: pre-commit/action@v3.0.0
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
args:
- "--fix"
- "--exit-non-zero-on-fix"
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
args:
- "-i"
- id: cppcheck
args:
- "--suppress=missingInclude"
- "--suppress=unmatchedSuppression"
- "--suppress=unusedFunction"
74 changes: 34 additions & 40 deletions bitbots_basler_camera/docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Full list of options at http://www.sphinx-doc.org/en/master/config

Expand All @@ -10,28 +9,30 @@
#
import os
import sys
import catkin_pkg.package

import catkin_pkg.package
from exhale import utils

package_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
catkin_package = catkin_pkg.package.parse_package(
os.path.join(package_dir, catkin_pkg.package.PACKAGE_MANIFEST_FILENAME))
os.path.join(package_dir, catkin_pkg.package.PACKAGE_MANIFEST_FILENAME)
)
sys.path.insert(0, os.path.abspath(os.path.join(package_dir, "src")))


# -- Helper functions --------------------------------------------------------


def count_files():
""":returns tuple of (num_py, num_cpp)"""
num_py = 0
num_cpp = 0

for root, dirs, files in os.walk(os.path.join(package_dir, "src")):
for _root, _dirs, files in os.walk(os.path.join(package_dir, "src")):
for f in files:
if f.endswith(".py"):
num_py += 1
for root, dirs, files in os.walk(os.path.join(package_dir, "include")):
for _root, _dirs, files in os.walk(os.path.join(package_dir, "include")):
for f in files:
if f.endswith(".h") or f.endswith(".hpp"):
num_cpp += 1
Expand All @@ -42,7 +43,7 @@ def count_files():
# -- Project information -----------------------------------------------------

project = catkin_package.name
copyright = '2019, Bit-Bots'
copyright = "2019, Bit-Bots"
author = ", ".join([a.name for a in catkin_package.authors])

# The short X.Y version
Expand All @@ -60,27 +61,27 @@ def count_files():
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.viewcode',
'sphinx_rtd_theme',
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.imgmath",
"sphinx.ext.viewcode",
"sphinx_rtd_theme",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -92,7 +93,7 @@ def count_files():
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
Expand All @@ -108,24 +109,17 @@ def count_files():

if num_files_cpp > 0:
extensions += [
'breathe',
'exhale',
"breathe",
"exhale",
]

breathe_projects = {
project: os.path.join("_build", "doxyoutput", "xml")
}
breathe_projects = {project: os.path.join("_build", "doxyoutput", "xml")}
breathe_default_project = project

def specifications_for_kind(kind):
# Show all members for classes and structs
if kind == "class" or kind == "struct":
return [
":members:",
":protected-members:",
":private-members:",
":undoc-members:"
]
return [":members:", ":protected-members:", ":private-members:", ":undoc-members:"]
# An empty list signals to Exhale to use the defaults
else:
return []
Expand All @@ -136,21 +130,19 @@ def specifications_for_kind(kind):
"rootFileName": "library_root.rst",
"rootFileTitle": "C++ Library API",
"doxygenStripFromPath": "..",
"customSpecificationsMapping": utils.makeCustomSpecificationsMapping(
specifications_for_kind
),
"customSpecificationsMapping": utils.makeCustomSpecificationsMapping(specifications_for_kind),
# Suggested optional arguments
"createTreeView": True,
"exhaleExecutesDoxygen": True,
"exhaleDoxygenStdin": "INPUT = {}".format(os.path.join(package_dir, "include"))
"exhaleDoxygenStdin": "INPUT = {}".format(os.path.join(package_dir, "include")),
}

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand All @@ -161,7 +153,7 @@ def specifications_for_kind(kind):
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand All @@ -173,21 +165,23 @@ def specifications_for_kind(kind):
#
# html_sidebars = {}

html_logo = os.path.join('_static', 'logo.png')
html_favicon = os.path.join('_static', 'logo.png')
html_logo = os.path.join("_static", "logo.png")
html_favicon = os.path.join("_static", "logo.png")


# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {"https://docs.python.org/": None}

# -- Options for todo extension ----------------------------------------------

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True

# -- RST Standard variables ---------------------------------------------------
rst_prolog = ".. |project| replace:: {}\n".format(project)
rst_prolog = f".. |project| replace:: {project}\n"
rst_prolog += ".. |description| replace:: {}\n".format(catkin_package.description.replace("\n\n", "\n"))
rst_prolog += ".. |modindex| replace:: {}\n".format(":ref:`modindex`" if num_files_py > 0 else "Python module index is not available")
rst_prolog += ".. |modindex| replace:: {}\n".format(
":ref:`modindex`" if num_files_py > 0 else "Python module index is not available"
)
7 changes: 4 additions & 3 deletions bitbots_basler_camera/setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from distutils.core import setup

from catkin_pkg.python_setup import generate_distutils_setup

d = generate_distutils_setup(
#packages=['bitbots_basler_camera'],
#scripts=['bin/myscript'],
#package_dir={'': 'src'}
# packages=['bitbots_basler_camera'],
# scripts=['bin/myscript'],
# package_dir={'': 'src'}
)

setup(**d)
Loading