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

First iteration of documentation and Lint workflow #1

Merged
merged 2 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--disable trailingCommas,unusedArguments

Choose a reason for hiding this comment

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

Why trailingCommas,unusedArguments are disabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as with SwiftLint rules. If you need more information you can check here: https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md

As they are only 2 I can quickly explain:

trailing commas - they basically on arrays add a comma on the last member, this conflicts with SwiftLint

let array = [
    foo,
    bar,
-   baz
  ]

  let array = [
    foo,
    bar,
+   baz,
  ]
  • unusedArguments - do an annoying thing that if you build just to check something it deletes the name of the fields you still didn't used.
- func foo(_ bar: Int) {
    ...
  }

+ func foo(_: Int) {
    ...
  }

Choose a reason for hiding this comment

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

Could you, please, explain why trailing commas conflict with SwiftLint? Trailing commas are the good thing in Swift?

Copy link
Contributor Author

@goncalo-frade-iohk goncalo-frade-iohk Aug 8, 2022

Choose a reason for hiding this comment

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

Could you, please, explain why trailing commas conflict with SwiftLint?

Because SwiftLint also has this rule https://realm.github.io/SwiftLint/trailing_comma.html that can be deactivated.

Trailing commas are the good thing in Swift?

It really doesn't matter. It's has to be with the style guide pattern, some will like it others will not. The style guide we use just went for this way, but as SwiftFormat does one way and SwiftLint does the other by default. One of them need to be deactivated.

--exclude Pods
109 changes: 109 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
disabled_rules:

Choose a reason for hiding this comment

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

Why these rules are disabled? Please, add some comments.

Copy link
Contributor Author

@goncalo-frade-iohk goncalo-frade-iohk Aug 8, 2022

Choose a reason for hiding this comment

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

IMO explaining each rule disabled or opted in is not a good process.

This are the rules we were previously using in all other Swift projects.
Also on CONTRIBUTING.md there is a topic about this matter, if there is a change needed around this file then I would say in the future other contributors can provide a PR with changes.

Meanwhile if there is really interest in knowing what are the disabled and option rules. You can check them in here: https://realm.github.io/SwiftLint/rule-directory.html

- todo
- colon
- opening_brace
- reduce_into
- vertical_parameter_alignment_on_call
- array_init
opt_in_rules:
- force_unwrapping
- force_cast
- anyobject_protocol
- array_init
- closure_spacing
- collection_alignment
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- empty_collection_literal
- empty_count
- empty_string
- empty_xctest_method
- enum_case_associated_values_count
- explicit_init
- extension_access_modifier
- fallthrough
- fatal_error_message
- file_header
- flatmap_over_map_reduce
- identical_operands
- joined_default_parameter
- last_where
- legacy_multiple
- legacy_random
- literal_expression_end_indentation
- lower_acl_than_parent
- modifier_order
- nimble_operator
- nslocalizedstring_key
- number_separator
- operator_usage_whitespace
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
- prefer_self_type_over_type_of_self
- private_action
- private_outlet
- prohibited_interface_builder
- prohibited_super_call
- quick_discouraged_call
- quick_discouraged_focused_test
- quick_discouraged_pending_test
- reduce_into
- redundant_nil_coalescing
- redundant_type_annotation
- single_test_class
- sorted_first_last
- sorted_imports
- static_operator
- strong_iboutlet
- test_case_accessibility
- toggle_bool
- unavailable_function
- unneeded_parentheses_in_closure_argument
- unowned_variable_capture
- untyped_error_in_catch
- vertical_parameter_alignment_on_call
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- xct_specific_matcher
- yoda_condition
excluded:
- build
- Pods
- protobuf
- PrismAPISDK
- Sources/PrismSwiftSDK/protobuf
- Tests/PrismSwiftSDKTests
line_length:
ignores_comments: true
ignores_urls: true
function_body_length:
warning: 100
error: 200
type_body_length:
warning: 350
error: 700
file_length:
ignore_comment_only_lines: true
cyclomatic_complexity:
warning: 25
error: 50
function_parameter_count:
warning: 12
error: 20
large_tuple:
warning: 4
error: 5
nesting:
type_level: 3
identifier_name:
max_length:
warning: 40
error: 100
allowed_symbols: ["_"] # these are allowed in constants names
excluded:
- id
- ec
reporter: "xcode"
233 changes: 233 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
# Contributing to Atala PRISM Swift SDK

:rocket::tada: First off, thanks for taking the time to contribute! :tada::rocket:
The following is a set of guidelines for contributing to Atala PRISM Swift SDK. These are mostly guidelines. Use your best judgment, and feel free to propose changes to this document in a pull request.
Copy link

@petevielhaber petevielhaber Aug 10, 2022

Choose a reason for hiding this comment

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

The following are guidelines for contributing to the Atala PRISM Swift SDK.


#### Table Of Contents

[What should I know before I get started?](#what-should-i-know-before-i-get-started)
* [Atala PRISM](#atala-prism)
* [Atala PRISM Swift SDK](#atala-prism-swift)

[How Can I Contribute?](#how-can-i-contribute)
* [Your First Code Contribution](#your-first-code-contribution)
* [Pull Requests](#pull-requests)
* [Reporting Bugs](#reporting-bugs)
* [Suggesting Enhancements](#suggesting-enhancements)

[Styleguides](#styleguides)
* [Git Commit Messages](#git-commit-messages)
* [Swift Styleguide](#swift-styleguide)
* [Documentation Styleguide](#documentation-styleguide)


## What should I know before I get started?

### Atala PRISM

Atala PRISM is a self-sovereign identity (SSI) platform and service suite for verifiable data and digital identity. Built on Cardano, it offers core infrastructure for issuing DIDs (Decentralized identifiers) and verifiable credentials, alongside tools and frameworks to help expand your ecosystem.

Choose a reason for hiding this comment

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

Atala PRISM is a Self-Sovereign Identity (SSI) platform and service suite for verifiable data and digital identity. Built on Cardano, it offers the core infrastructure for issuing Decentralized Identifiers (DIDs) and Verifiable Credentials (VCs), alongside tools and frameworks to help expand your ecosystem.

The complete platform is separated in multiple repositories:

* [atala-prism-apollo](--) - Repo for the Apollo Building Block, this contains the collecion of the cryptographic methods used all around Atala PRISM.

Choose a reason for hiding this comment

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

Repo for the Apollo Building Block contains the collection of the cryptographic methods used by Atala PRISM.

* [atala-prism-building-blocks](https://github.com/input-output-hk/atala-prism-building-blocks) - Repo that contains the servers Building Blocks.
* [atala-prism-kmm-sdk](--) - Repo that represents the Kotlin Multiplatform SDK.

### Atala PRISM Swift SDK

Atala PRISM Swift software development kit will help adoption within Apple frameworks by providing key functionalities. For more information around the SDK please have a look at the [Readme](https://github.com/input-output-hk/atala-prism-swift-sdk/blob/main/README.md)
Copy link

@petevielhaber petevielhaber Aug 10, 2022

Choose a reason for hiding this comment

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

Atala PRISM's Swift software development kit will help adoption within Apple frameworks by providing key functionalities. For more information about the SDK, please review the README.


### Your First Code Contribution

Unsure where to begin contributing to Atala PRISM Swift SDK? You can start by looking through the [Readme](https://github.com/input-output-hk/atala-prism-swift-sdk/blob/main/README.md) that provides all the steps to setup your environment.

Choose a reason for hiding this comment

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


### Pull Requests

The process described here has several goals:

Choose a reason for hiding this comment

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

The process described has several goals:


- Maintain the SDK quality
- Fix problems that are important to users
- Engage the community in working toward the best possible product
- Enable a sustainable system for the SDK maintainers to review contributions

Please follow these steps to have your contribution considered by the maintainers:

1. Follow all instructions in [the template](PULL_REQUEST_TEMPLATE.md)
2. Follow the [styleguides](#styleguides)
3. After you submit your pull request, verify that all [status checks](https://help.github.com/articles/about-status-checks/) are passing <details><summary>What if the status checks are failing?</summary>If a status check is failing, and you believe that the failure is unrelated to your change, please leave a comment on the pull request explaining why you believe the failure is unrelated. A maintainer will re-run the status check for you. If we conclude that the failure was a false positive, then we will open an issue to track that problem with our status check suite.</details>

Choose a reason for hiding this comment

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

  1. After you submit your pull request, verify that all status checks are passing
    What if the status checks are failing?If a status check is failing, and you believe the failure is unrelated to your change, please comment on the pull request explaining why you believe the failure is unrelated. A maintainer will re-run the status check for you. If we conclude that the failure was a false positive, we will open an issue to track that problem with our status check suite.


While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted.

Choose a reason for hiding this comment

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

While the prerequisites above must be satisfied before your pull request gets reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes, before your pull request gets accepted.


### Reporting Bugs
goncalo-frade-iohk marked this conversation as resolved.
Show resolved Hide resolved

This section guides you through submitting a bug report for Atala PRISM Swift SDK. Following these guidelines helps maintainers and the community understand your report :pencil:, reproduce the behavior :computer: :computer:, and find related reports :mag_right:.

Choose a reason for hiding this comment

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

This section guides you through submitting a bug report for the Atala PRISM Swift SDK. Following these guidelines helps maintainers and the community understand your report 📝, reproduce the behavior 💻 💻, and find related reports 🔎.


Before creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](https://github.com/input-output-hk/atala-prism-swift-sdk/blob/main/.github/ISSUE_TEMPLATE/bug_report.md), the information it asks for helps us resolve issues faster.

Choose a reason for hiding this comment

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

Before creating bug reports, please check this list as you might find out that you don't need to create one. When you create a bug report, please include as many details as possible. Fill out the required template with the information it asks for helps us resolve issues faster.


> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.

Choose a reason for hiding this comment

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

Note: If you find a Closed issue that seems like it is the same thing you're experiencing, open a new issue and include a link to the original issue in the body of your new one.


* **You might be able to find the cause of the problem and fix things yourself by Debugging**. Most importantly, check if you can reproduce the problem in the latest version.
* **Check the [Readme](https://github.com/input-output-hk/atala-prism-swift-sdk/blob/main/README.md) ** if you have problems on the setup and the [discussions](https://github.com/input-output-hk/atala-prism-swift-sdk/discussions)** for a list of common questions and problems.

Choose a reason for hiding this comment

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

Check the Readme ** if you have problems with the setup and the discussions** for a list of common questions and issues.

* **Perform a cursory search to see if the problem has already been reported**. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one.

Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). Create an issue on that repository and provide the following information by filling in [the template](https://github.com/input-output-hk/atala-prism-swift-sdk/blob/main/.github/ISSUE_TEMPLATE/bug_report.md).

Explain the problem and include additional details to help maintainers reproduce the problem:

* **Use a clear and descriptive title** for the issue to identify the problem.
* **Describe the exact steps which reproduce the problem** in as many details as possible.

Choose a reason for hiding this comment

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

  • Describe the exact steps which reproduce the problem in as much detail as possible.

* **Provide specific examples to demonstrate the steps**. Include links to files or GitHub projects, or copy/pasteable snippets, which you use in those examples. If you're providing snippets in the issue, use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).

Choose a reason for hiding this comment

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

Provide specific examples to demonstrate the steps. Include links to files, GitHub projects, or copy/pasteable snippets you use in those examples. If you're providing snippets in the issue, use Markdown code blocks.

* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
* **Explain which behavior you expected to see instead and why.**
* **If you're reporting that the SDK crashed**, include a crash report with a stack trace from the operating system. On macOS, the crash report will be available in `Console.app` under "Diagnostic and usage information" > "User diagnostic reports". Include the crash report in the issue in a [code block](https://help.github.com/articles/markdown-basics/#multiple-lines), a [file attachment](https://help.github.com/articles/file-attachments-on-issues-and-pull-requests/), or put it in a [gist](https://gist.github.com/) and provide link to that gist.
* **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below.

Choose a reason for hiding this comment

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

  • **If a specific action ** didn't trigger the problem, describe what you were doing before the problem happened and share more information using the guidelines below.


Provide more context by answering these questions:

* **Did the problem start happening recently** (e.g. after updating to a new version of the SDK) or was this always a problem?

Choose a reason for hiding this comment

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

  • Did the problem start happening recently (e.g., after updating to a new version of the SDK), or was this always a problem?

* If the problem started happening recently, **can you reproduce the problem in an older version of the SDK?** What's the most recent version in which the problem doesn't happen?
* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.

Choose a reason for hiding this comment

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

  • Can you reliably reproduce the issue? If not, provide details about how often the problem happens and under which conditions it usually happens.


### Suggesting Enhancements

This section guides you through submitting an enhancement suggestion for the SDK, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion :pencil: and find related suggestions :mag_right:.

Choose a reason for hiding this comment

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

This section guides you through submitting an enhancement suggestion for the SDK, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your request:pencil: and find related suggestions :mag_right:.


Before creating enhancement suggestions, please check [this list](#before-submitting-an-enhancement-suggestion) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-enhancement-suggestion). Fill in [the template](https://github.com/input-output-hk/atala-prism-swift-sdk/blob/main/.github/ISSUE_TEMPLATE/feature_request.md), including the steps that you imagine you would take if the feature you're requesting existed.

* Most importantly, **check if you're using the lattest version.**
* **Perform a cursory search** to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.

Choose a reason for hiding this comment

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

  • Perform a cursory search to see if a similar enhancement exists. If one does, add a comment to the existing issue instead of opening a new one.


Enhancement suggestions are tracked as [GitHub issues](https://guides.github.com/features/issues/). Create an issue on that repository and provide the following information:

* **Use a clear and descriptive title** for the issue to identify the suggestion.
* **Provide a step-by-step description of the suggested enhancement** in as many details as possible.

Choose a reason for hiding this comment

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

  • Provide a detailed description of the suggested enhancement in as much detail as possible.

* **Provide specific examples to demonstrate the steps**. Include copy/pasteable snippets which you use in those examples, as [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).
* **Describe the current behavior** and **explain which behavior you expected to see instead** and why.
* **Explain why this enhancement would be useful**.
* **List some other text editors or applications where this enhancement exists.**
* **Specify which version of the SDK you're using.**
* **Specify the name and version of the OS you're using.**

## Styleguides

### Git Commit Messages

Atala PRISM uses [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#specification) please always provide a commit following this specifications.
yshyn-iohk marked this conversation as resolved.
Show resolved Hide resolved

#### Commit Message Format

We have very precise rules over how our Git commit messages must be formatted.
This format leads to **easier to read commit history**.

Each commit message consists of a **header**, a **body**, and a **footer**.

```
<header>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```

The `header` is mandatory and must conform to the [Commit Message Header](#commit-header) format.

The `body` is mandatory for all commits except for those of type "docs".
When the body is present it must be at least 20 characters long and must conform to the [Commit Message Body](#commit-body) format.

The `footer` is optional. The [Commit Message Footer](#commit-footer) format describes what the footer is used for and the structure it must have.


#### Commit Message Header

```
<type>(<scope>): <short summary>
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope: apollo|castor|pollux|mercury|pluto|domain|experience
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test
```

The `<type>` and `<summary>` fields are mandatory, the `(<scope>)` field is optional.


##### Type

Must be one of the following:

* **build**: Changes that affect the build system or external dependencies
* **ci**: Changes to the CI configuration files and scripts
* **docs**: Documentation only changes
* **feat**: A new feature
* **fix**: A bug fix
* **perf**: A code change that improves performance
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **test**: Adding missing tests or correcting existing tests


##### Scope
The scope should be the name of the affected module or building block
(as perceived by the person reading the changelog generated from commit messages).

The following is the list of supported scopes:

* `castor`
* `pollux`
* `mercury`
* `pluto`
* `domain`
* `experience`

##### Summary

Use the summary field to provide a succinct description of the change:

* use the imperative, present tense: "change" not "changed" nor "changes"
* don't capitalize the first letter
* no dot (.) at the end


#### <a name="commit-body"></a>Commit Message Body

Just as in the summary, use the imperative, present tense: "fix" not "fixed" nor "fixes".

Explain the motivation for the change in the commit message body. This commit message should explain _why_ you are making the change.
You can include a comparison of the previous behavior with the new behavior in order to illustrate the impact of the change.


#### <a name="commit-footer"></a>Commit Message Footer

The footer can contain information about breaking changes and deprecations and is also the place to reference GitHub issues, Jira tickets, and other PRs that this commit closes or is related to.
For example:

```
BREAKING CHANGE: <breaking change summary>
<BLANK LINE>
<breaking change description + migration instructions>
<BLANK LINE>
<BLANK LINE>
Fixes ATL-<issue number>
```

or

```
DEPRECATED: <what is deprecated>
<BLANK LINE>
<deprecation description + recommended update path>
<BLANK LINE>
<BLANK LINE>
Related to ATL-<issue number>
```

Breaking Change section should start with the phrase "BREAKING CHANGE: " followed by a summary of the breaking change, a blank line, and a detailed description of the breaking change that also includes migration instructions.

Similarly, a Deprecation section should start with "DEPRECATED: " followed by a short description of what is deprecated, a blank line, and a detailed description of the deprecation that also mentions the recommended update path.

### Swift Styleguide

The Swift style guide is maintained by tools like SwiftLint and SwiftFormat. That will follow the [The Official raywenderlich.com Swift Style Guide.](https://github.com/raywenderlich/swift-style-guide).

### Documentation Styleguide

WIP
2 changes: 2 additions & 0 deletions Mintfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
realm/[email protected]
nicklockwood/[email protected]
Loading