diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..c3573569 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.11.12 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15bf5b9b..853a8a87 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,6 +79,47 @@ is being made): 4. **Find something to work on**: Browse the [issues](https://github.com/apache/ossie/issues), or raise a topic on the dev list. 5. **Submit a Pull Request**: Fork the repository, make your changes, and submit a pull request. All contributions go through the review process described below. +## Development Setup + +### Python + +The project uses [ruff](https://docs.astral.sh/ruff/) for linting and formatting +across all Python packages. A shared configuration lives in the top-level `ruff.toml`. + +```bash +# Install ruff (if not already available) +pip install ruff + +# Check for lint issues +make lint + +# Auto-format code +make format + +# Check formatting without modifying files +make format-check +``` + +**Optional: pre-commit hooks** — If you'd like automatic formatting on every commit: + +```bash +pip install pre-commit +pre-commit install +``` + +This runs ruff lint (with auto-fix) and ruff format before each commit, so issues +are caught locally before pushing. + +### Go + +The `cli/` directory has its own `Makefile` with `make lint` (runs `go vet`) and +`make format` (runs `gofmt`). + +### Java + +The Maven converters (`converters/salesforce/`, `converters/polaris/`) are built with +`mvn verify`. Apache RAT checks license headers during the verify phase. + ## Contributor License Agreement (ICLA) All contributions to Apache Ossie are made under the [Apache License 2.0](LICENSE). diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..31ff2b74 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +.PHONY: lint format + +lint: + @echo "Running ruff check on all Python packages..." + ruff check python/ converters/ validation/ + +format: + @echo "Running ruff format on all Python packages..." + ruff format python/ converters/ validation/ + +format-check: + @echo "Checking formatting (no changes)..." + ruff format --check python/ converters/ validation/ diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 00000000..e942cfbf --- /dev/null +++ b/ruff.toml @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +line-length = 120 +target-version = "py311" + +[lint] +select = ["E", "F", "I", "UP", "W"] +ignore = ["E501"] + +[format] +quote-style = "double"