Skip to content

Commit

Permalink
Merge pull request #297 from ioannis-vm/code_quality
Browse files Browse the repository at this point in the history
Code quality
  • Loading branch information
fmckenna authored Aug 13, 2024
2 parents 1688641 + fca51cd commit 7cc86dc
Show file tree
Hide file tree
Showing 464 changed files with 80,373 additions and 59,158 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/format_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Format Check

on: [push, pull_request]

jobs:
format-check:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Check code formatting
run: |
ruff check . --diff
25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run linter
run: |
ruff check .
25 changes: 25 additions & 0 deletions .github/workflows/spell_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Spell Check

on: [push, pull_request]

jobs:
spell-check:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install codespell
run: |
python -m pip install --upgrade pip
pip install codespell
- name: Run codespell
run: |
codespell .
9 changes: 5 additions & 4 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python # noqa: EXE001, D100, CPY001

from bincrafters import build_template_default

if __name__ == "__main__":
builder = build_template_default.get_builder(build_types=["Release"], archs=["x86_64"])
if __name__ == '__main__':
builder = build_template_default.get_builder(
build_types=['Release'], archs=['x86_64']
)
builder.run()
2 changes: 1 addition & 1 deletion cmake/SimCenterFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set(SIMCENTER_GLOB_FILES *.cpp
# Careful: when file was added or deleted, cmake has to be run again
# EXCLUDE [optional] Files that should not be included in the module (but are located in module directory).
# This makes only sense if FILES was not specified, and all files have been added automatically.
# BUILD_ONLY_IF_FOUND Before building the module test if all libraries specified here are availbable.
# BUILD_ONLY_IF_FOUND Before building the module test if all libraries specified here are available.
# [optional] This is done using the ${arg}_FOUND variable.
# Example: simcenter_add_module(DEPENDS someModule BUILD_ONLY_IF_FOUND something)
# This module is only built if SOMETHING_FOUND is true.
Expand Down
2 changes: 1 addition & 1 deletion cmake/SimCenterModuleDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ endfunction(target_link_modules)

#######################################################################################################################
# If path contains a CMakeLists.txt, path is returned
# otherwise recursivly the parent directories are checked and returned if they contain a CMakeLists.txt
# otherwise recursively the parent directories are checked and returned if they contain a CMakeLists.txt
#######################################################################################################################

function(get_parent_with_cmakelists result dir)
Expand Down
96 changes: 54 additions & 42 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,57 +1,69 @@
from conans import ConanFile, CMake, tools
import os

class simCenterBackendApps(ConanFile):
name = "SimCenterBackendApplications"
version = "1.2.2"
description = "Backend applications for SimCenter software"
license = "BSD 3-Clause"
author = "Michael Gardner [email protected]"
url = "https://github.com/NHERI-SimCenter/SimCenterBackendApplications"
settings = {"os": None, "build_type": None, "compiler": None, "arch": ["x86_64","armv8"]}
options = {"shared": [True, False]}
default_options = {"mkl-static:threaded": False, "ipp-static:simcenter_backend": True, "libcurl:with_ssl":"openssl"}
generators = "cmake"
build_policy = "missing"
requires = ["jansson/2.13.1",
"zlib/1.2.11",
"libcurl/8.1.1",
"eigen/3.3.7",
"clara/1.1.5",
"jsonformoderncpp/3.7.0",
"nanoflann/1.3.2",
"nlopt/2.7.1"]

import os # noqa: D100, CPY001

from conans import CMake, ConanFile


class simCenterBackendApps(ConanFile): # noqa: D101
name = 'SimCenterBackendApplications'
version = '1.2.2'
description = 'Backend applications for SimCenter software'
license = 'BSD 3-Clause'
author = 'Michael Gardner [email protected]'
url = 'https://github.com/NHERI-SimCenter/SimCenterBackendApplications'
settings = { # noqa: RUF012
'os': None,
'build_type': None,
'compiler': None,
'arch': ['x86_64', 'armv8'],
}
options = {'shared': [True, False]} # noqa: RUF012
default_options = { # noqa: RUF012
'mkl-static:threaded': False,
'ipp-static:simcenter_backend': True,
'libcurl:with_ssl': 'openssl',
}
generators = 'cmake'
build_policy = 'missing'
requires = [ # noqa: RUF012
'jansson/2.13.1',
'zlib/1.2.11',
'libcurl/8.1.1',
'eigen/3.3.7',
'clara/1.1.5',
'jsonformoderncpp/3.7.0',
'nanoflann/1.3.2',
'nlopt/2.7.1',
]

# Custom attributes for Bincrafters recipe conventions
_source_subfolder = "source_subfolder"
_build_subfolder = "build_subfolder"
_source_subfolder = 'source_subfolder'
_build_subfolder = 'build_subfolder'
# Set short paths for Windows
short_paths = True
scm = {
"type": "git", # Use "type": "svn", if local repo is managed using SVN
"subfolder": _source_subfolder,
"url": "auto",
"revision": "auto"
short_paths = True
scm = { # noqa: RUF012
'type': 'git', # Use "type": "svn", if local repo is managed using SVN
'subfolder': _source_subfolder,
'url': 'auto',
'revision': 'auto',
}


def configure(self):
def configure(self): # noqa: D102
self.options.shared = False

def configure_cmake(self):
def configure_cmake(self): # noqa: D102
cmake = CMake(self)
cmake.configure(source_folder=self._source_subfolder)
return cmake
def build(self):

def build(self): # noqa: D102
cmake = self.configure_cmake()
cmake.build()

def package(self):
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
def package(self): # noqa: D102
self.copy(pattern='LICENSE', dst='licenses', src=self._source_subfolder)
cmake = self.configure_cmake()
cmake.install()
self.copy("*", dst="bin", src=self._source_subfolder + "/applications")
self.copy('*', dst='bin', src=self._source_subfolder + '/applications')

def package_info(self):
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
def package_info(self): # noqa: D102
self.env_info.PATH.append(os.path.join(self.package_folder, 'bin')) # noqa: PTH118
23 changes: 23 additions & 0 deletions ignore_words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
theRes
nd
ned
pres
writeT
sOrD
responseD
WORKD
workd
oT
WriteT
Suh
WLL
VIE
Momento
lamda
dum
numer
reord
fro
Equil
ot
repID
4 changes: 2 additions & 2 deletions meta/backends.cache.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"name": "buildingFile",
"type": "FileName(W)",
"default": "buildingsFile.json",
"help": "name of JSON file containing an array of id,filename pairs. For each building id the aplication creates a BIM file with name filename",
"help": "name of JSON file containing an array of id,filename pairs. For each building id the application creates a BIM file with name filename",
"app-specific": true
},
{
Expand Down Expand Up @@ -649,7 +649,7 @@
{
"name": "pathSW4results",
"type": "path",
"help": "Path to directory containig output point files",
"help": "Path to directory containing output point files",
"app-specific": true
}
],
Expand Down
2 changes: 1 addition & 1 deletion modules/ErrorCodes.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
100, Workflow Application Failed
101, Workflow Application failed to open input file
102, Workflow Application Failed to find approprate application
102, Workflow Application Failed to find appropriate application
103, Workflow Application failed to launch a workflow application
200, BIM application Failed
300, EVENT application failed
Expand Down
Loading

0 comments on commit 7cc86dc

Please sign in to comment.