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

Add Commit hook install script #1845

Merged
merged 8 commits into from
Aug 23, 2023
Merged

Add Commit hook install script #1845

merged 8 commits into from
Aug 23, 2023

Conversation

afterxleep
Copy link
Collaborator

@afterxleep afterxleep commented Jul 19, 2023

Task URL: https://app.asana.com/0/1200194497630846/1205110674679790/f

Descrption:

Adds a script that allows us to automatically install a pre-commit hook that runs swiftlint --fix

The original installation script lives in BSK for easier maintenance. App Scripts download it and install it locally. (Remote URL will be updated once we merge BSK. This script can be extended as necesary to install/manage additional pre-commit hooks

How to test:

  • Install the hook with ./scripts/pre-commit.sh --install

  • Add a few trail whitespaces to a file

  • Build the project

  • Commit the changes

  • Observe whitespace was magically cleaned up

  • Uninstall the hook with ./scripts/pre-commit.sh --install

  • Add a few trail whitespaces to a file

  • Build the project

  • Commit the changes

  • Observe whitespace warnings are still there

This hook also automatically correct the following rules:**

  • anyobject_protocol
  • closing_brace
  • closure_end_indentation
  • closure_spacing
  • colon
  • comma
  • comma_inheritance
  • comment_spacing
  • control_statement
  • direct_return
  • duplicate_imports
  • empty_enum_arguments
  • empty_parameters
  • empty_parentheses_with_trailing_closure
  • explicit_init
  • explicit_self
  • implicit_return
  • joined_default_parameter
  • leading_whitespace
  • legacy_cggeometry_functions
  • legacy_constant
  • legacy_constructor
  • legacy_nsgeometry_functions
  • literal_expression_end_indentation
  • lower_acl_than_parent
  • mark
  • modifier_order
  • nimble_operator
  • no_space_in_method_call
  • number_separator
  • opening_brace
  • operator_usage_whitespace
  • optional_enum_case_matching
  • period_spacing
  • prefer_self_in_static_references
  • prefer_self_type_over_type_of_self
  • prefer_zero_over_explicit_init
  • private_over_fileprivate
  • private_unit_test
  • protocol_property_accessors_order
  • redundant_discardable_let
  • redundant_nil_coalescing
  • redundant_objc_attribute
  • redundant_optional_initialization
  • redundant_self_in_closure
  • redundant_type_annotation
  • redundant_void_return
  • return_arrow_whitespace
  • self_binding
  • shorthand_optional_binding
  • sorted_imports
  • statement_position
  • strong_iboutlet
  • syntactic_sugar
  • test_case_accessibility
  • toggle_bool
  • trailing_comma
  • trailing_newline
  • trailing_semicolon
  • trailing_whitespace
  • unneeded_parentheses_in_closure_argument
  • unneeded_synthesized_initializer
  • untyped_error_in_catch
  • unused_closure_parameter
  • unused_control_flow_label
  • unused_import
  • vertical_whitespace
  • vertical_whitespace_between_cases
  • vertical_whitespace_closing_braces
  • vertical_whitespace_opening_braces
  • void_return

@afterxleep afterxleep changed the title Add —fix to swiftlint Add Commit hook install script Aug 4, 2023
Copy link
Contributor

@ayoy ayoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like for macOS, this could also be simplified to 2 lines:
duckduckgo/macos-browser#1369 (comment)

afterxleep added a commit to duckduckgo/BrowserServicesKit that referenced this pull request Aug 23, 2023
Please review the release process for BrowserServicesKit here.

Required:
Task/Issue URL: https://app.asana.com/0/1200194497630846/1205110674679790/f
iOS PR: duckduckgo/iOS#1845
macOS PR: duckduckgo/macos-browser#1369
What kind of version bump will this require?: None, this is just a CI change

Descrption:

Adds a script that allows us to automatically install a pre-commit hook that runs swiftlint --fix

The original installation script lives in BSK for easier maintenance. App Scripts download it and install it locally. (Remote URL will be updated once we merge BSK. This script can be extended as necesary to install/manage additional pre-commit hooks
@afterxleep afterxleep merged commit 4313e81 into develop Aug 23, 2023
8 checks passed
@afterxleep afterxleep deleted the daniel/lint-fixes branch August 23, 2023 13:14
samsymons added a commit that referenced this pull request Aug 24, 2023
* develop: (84 commits)
  Improve Sync-related database cleaning logic (#1933)
  Fix PacketTunnelProvider embedding for Alpha builds (#1932)
  Add alpha specific app groups (#1934)
  Replaces useSystemKeychain with keychain type (#1928)
  Add Commit hook install script (#1845)
  Run checks on all PRs (#1929)
  extend valid urls to include IPv6 (#1919)
  Status view error UI (#1915)
  NetP Design Review minus errors (#1923)
  Add a GHA job to build the app in release configuration (#1848)
  Release 7.85.0 (#1926)
  Update WireGuard version (#1918)
  BSK Hotfix 74.0.1-1 (#1924)
  Post merge PR check (#1920)
  Autofill letter icons for macOS (#1911)
  Alpha build readiness (#1913)
  bump C-S-S to 4.32.0 (#1914)
  Update NetP endpoint (#1905)
  Network Protection debug menu (#1910)
  Add support for syncing Credentials (#1844)
  ...
THISISDINOSAUR pushed a commit that referenced this pull request Aug 24, 2023
Task URL: https://app.asana.com/0/1200194497630846/1205110674679790/f

Descrption:

Adds a script that allows us to automatically install a pre-commit hook that runs swiftlint --fix

The original installation script lives in BSK for easier maintenance. App Scripts download it and install it locally. (Remote URL will be updated once we merge BSK. This script can be extended as necesary to install/manage additional pre-commit hooks
THISISDINOSAUR added a commit that referenced this pull request Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants