Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: change checkstyle to google code format, plus adding spotless #1264

Merged
Show file tree
Hide file tree
Changes from 4 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
72 changes: 72 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true

ij_continuation_indent_size = 8

[*.md]
max_line_length = off
trim_trailing_whitespace = false

# Following the rules of the Google Java Style Guide.
# See https://google.github.io/styleguide/javaguide.html
[*.java]
max_line_length = 120

ij_java_do_not_wrap_after_single_annotation_in_parameter = true
ij_java_insert_inner_class_imports = false
ij_java_class_count_to_use_import_on_demand = 999
ij_java_names_count_to_use_import_on_demand = 999
ij_java_packages_to_use_import_on_demand = unset
ij_java_imports_layout = $*,|,*
ij_java_doc_align_param_comments = true
ij_java_doc_align_exception_comments = true
ij_java_doc_add_p_tag_on_empty_lines = false
ij_java_doc_do_not_wrap_if_one_line = true
ij_java_doc_keep_empty_parameter_tag = false
ij_java_doc_keep_empty_throws_tag = false
ij_java_doc_keep_empty_return_tag = false
ij_java_doc_preserve_line_breaks = true
ij_java_doc_indent_on_continuation = true
ij_java_keep_control_statement_in_one_line = false
ij_java_keep_blank_lines_in_code = 1
ij_java_align_multiline_parameters = false
ij_java_align_multiline_resources = false
ij_java_align_multiline_for = true
ij_java_space_before_array_initializer_left_brace = true
ij_java_call_parameters_wrap = normal
ij_java_method_parameters_wrap = normal
ij_java_extends_list_wrap = normal
ij_java_throws_keyword_wrap = normal
ij_java_method_call_chain_wrap = normal
ij_java_binary_operation_wrap = normal
ij_java_binary_operation_sign_on_next_line = true
ij_java_ternary_operation_wrap = normal
ij_java_ternary_operation_signs_on_next_line = true
ij_java_keep_simple_methods_in_one_line = true
ij_java_keep_simple_lambdas_in_one_line = true
ij_java_keep_simple_classes_in_one_line = true
ij_java_for_statement_wrap = normal
ij_java_array_initializer_wrap = normal
ij_java_wrap_comments = true
ij_java_if_brace_force = always
ij_java_do_while_brace_force = always
ij_java_while_brace_force = always
ij_java_for_brace_force = always
ij_java_space_after_closing_angle_bracket_in_type_argument = false

[{*.json,*.json5}]
indent_size = 2
tab_width = 2
ij_smart_tabs = false

[*.yaml]
indent_size = 2
tab_width = 2
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,38 @@ If you think we might be out of date with the spec, you can check that by invoki

If you're adding tests to cover something in the spec, use the `@Specification` annotation like you see throughout the test suites.

## Code Styles

### Overview
Our project follows strict code formatting standards to maintain consistency and readability across the codebase. We use [Spotless](https://github.com/diffplug/spotless) integrated with the [Palantir Java Format](https://github.com/palantir/palantir-java-format) for code formatting.

**Spotless** ensures that all code complies with the formatting rules automatically, reducing style-related issues during code reviews.

### How to Format Your Code
1. **Before Committing Changes:**
Run the Spotless plugin to format your code. This will apply the Palantir Java Format style:
```bash
mvn spotless:apply
```

2. **Verify Formatting:**
To check if your code adheres to the style guidelines without making changes:
```bash
mvn spotless:check
```

- If this command fails, your code does not follow the required formatting. Use `mvn spotless:apply` to fix it.

### CI/CD Integration
Our Continuous Integration (CI) pipeline automatically checks code formatting using the Spotless plugin. Any code that does not pass the `spotless:check` step will cause the build to fail.

### Best Practices
- Regularly run `mvn spotless:apply` during your work to ensure your code remains aligned with the standards.
- Configure your IDE (e.g., IntelliJ IDEA or Eclipse) to follow the Palantir Java format guidelines to reduce discrepancies during development.

### Support
If you encounter issues with code formatting, please raise a GitHub issue or contact the maintainers.

## End-to-End Tests

The continuous integration runs a set of [gherkin e2e tests](https://github.com/open-feature/spec/blob/main/specification/assets/gherkin/evaluation.feature) using `InMemoryProvider`.
Expand Down
259 changes: 188 additions & 71 deletions checkstyle.xml

Large diffs are not rendered by default.

Loading
Loading