Skip to content

Commit

Permalink
Merge pull request #460 from henrikth93/henrikt93-pre-commit-#450
Browse files Browse the repository at this point in the history
Created .pre-commit-config.yaml and installed hooks
  • Loading branch information
andrewtavis authored Jun 12, 2024
2 parents 60a4f11 + e3f28ac commit 34d41bf
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 28 deletions.
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/realm/SwiftLint
rev: 0.55.1
hooks:
- id: swiftlint
entry: swiftlint --strict
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/).
- SwiftFormat was configured to allow for the removal of trailing commas ([#421](https://github.com/scribe-org/Scribe-iOS/issues/421)).
- Trailing commas were removed from the codebase ([#421](https://github.com/scribe-org/Scribe-iOS/issues/421)).
- Extra whitespace was removed from the codebase ([#429](https://github.com/scribe-org/Scribe-iOS/issues/429)).
- pre-commit hooks were added to the codebase to fix common errors on commit ([#450](https://github.com/scribe-org/Scribe-iOS/issues/450)).

# Scribe-iOS 2.3.0

Expand Down
12 changes: 10 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,17 @@ git remote add upstream https://github.com/scribe-org/Scribe-iOS.git
- `origin` (forked repository)
- `upstream` (Scribe-iOS repository)

3. Open the Scribe-iOS directory in Xcode
3. (Optional) Install [pre-commit](https://pre-commit.com/) and its hooks to check for and correct common errors in commits:

4. In order to run Scribe on an emulator:
```bash
pip install pre-commit
pre-commit install
# pre-commit run --all-files
```

4. Open the Scribe-iOS directory in Xcode

5. In order to run Scribe on an emulator:

- Read the [documentation from Apple](https://developer.apple.com/documentation/xcode/running-your-app-in-the-simulator-or-on-a-device) if need be
- In the top bar select Scribe as the scheme
Expand Down
32 changes: 11 additions & 21 deletions Keyboards/KeyboardsBase/KeyboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class KeyboardViewController: UIInputViewController {
func setInformationState() {
setFormDisplay1x1View()
let contentData = InformationToolTipData.getContent()
let datasources = contentData.enumerated().compactMap { _, text in
let datasources = contentData.compactMap { text in
createInformationStateDatasource(text: text, backgroundColor: keyColor)
}
tipView = ToolTipView(datasources: datasources)
Expand Down Expand Up @@ -657,15 +657,7 @@ class KeyboardViewController: UIInputViewController {
allowUndo = false
firstCompletionIsHighlighted = false
// Highlight if the current prefix is the first autocompletion.
if
currentPrefix == completionWords[0] && completionWords[1] != " "

// Note: Code for highlighting the word if it's the only option available - add when libraries are expanded.
// || (
// // Highlighting last remaining autocomplete.
// completionWords[0] != " " && completionWords[1] == " "
// )
{
if currentPrefix == completionWords[0] && completionWords[1] != " " {
firstCompletionIsHighlighted = true
}
setBtn(
Expand Down Expand Up @@ -1242,8 +1234,7 @@ class KeyboardViewController: UIInputViewController {
} else if
commandState == .selectCaseDeclension
&& controllerLanguage == "German"
&& deCaseVariantDeclensionState != .disabled
{
&& deCaseVariantDeclensionState != .disabled {
switch deCaseVariantDeclensionState {
case .disabled:
break
Expand Down Expand Up @@ -1271,12 +1262,9 @@ class KeyboardViewController: UIInputViewController {
.accusativeDefinite, .accusativeIndefinite, .accusativeDemonstrative,
.dativeDefinite, .dativeIndefinite, .dativeDemonstrative,
.genitiveDefinite, .genitiveIndefinite, .genitiveDemonstrative
].contains(deCaseDeclensionState)
{
].contains(deCaseDeclensionState) {
formsDisplayDimensions = .view2x2
} else if
commandState == .displayInformation
{
} else if commandState == .displayInformation {
formsDisplayDimensions = .view1x1
} else {
formsDisplayDimensions = .view3x2
Expand Down Expand Up @@ -1671,11 +1659,13 @@ class KeyboardViewController: UIInputViewController {
if DeviceType.isPad
&& key == "a"
&& !usingExpandedKeyboard
&& (controllerLanguage == "Portuguese"
&& (
controllerLanguage == "Portuguese"
|| controllerLanguage == "Italian"
|| commandState == .translate) {
leftPadding = keyWidth / 3
addPadding(to: stackView1, width: leftPadding, key: "a")
|| commandState == .translate
) {
leftPadding = keyWidth / 3
addPadding(to: stackView1, width: leftPadding, key: "a")
}
if DeviceType.isPad
&& key == "@"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Controls the ToolTipViewDatasourceable protocol.
*
*
* Copyright (C) 2023 Scribe
*
* This program is free software: you can redistribute it and/or modify
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Controls the ToolTipViewUpdatable protocol.
*
*
* Copyright (C) 2023 Scribe
*
* This program is free software: you can redistribute it and/or modify
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Controls the ViewThemeable protocol.
*
*
* Copyright (C) 2023 Scribe
*
* This program is free software: you can redistribute it and/or modify
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,17 @@ git remote add upstream https://github.com/scribe-org/Scribe-iOS.git
- `origin` (forked repository)
- `upstream` (Scribe-iOS repository)

3. Open the Scribe-iOS directory in Xcode
3. (Optional) Install [pre-commit](https://pre-commit.com/) and its hooks to check for and correct common errors in commits:

4. In order to run Scribe on an emulator:
```bash
pip install pre-commit
pre-commit install
# pre-commit run --all-files
```

4. Open the Scribe-iOS directory in Xcode

5. In order to run Scribe on an emulator:

- Read the [documentation from Apple](https://developer.apple.com/documentation/xcode/running-your-app-in-the-simulator-or-on-a-device) if need be
- In the top bar select Scribe as the scheme
Expand Down

0 comments on commit 34d41bf

Please sign in to comment.