Skip to content

Conversation

@parhamsaremi
Copy link
Contributor

@parhamsaremi parhamsaremi commented Jul 20, 2022

Checks for OCaml and CSharp styles. Fixes #532

add .vscode to .gitignore
@parhamsaremi parhamsaremi force-pushed the issue532-squashed-fixed branch from a8e55ba to 98f3cbd Compare July 20, 2022 12:16
@parhamsaremi parhamsaremi changed the title Add new rule IndexerAccessorStyleConsistency for OCaml and CSharp styles Add new rule IndexerAccessorStyleConsistency Jul 20, 2022
| _ ->
Array.empty
else
failwith (String.Format("Unknown style type %s", styleType))
Copy link
Collaborator

Choose a reason for hiding this comment

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

@parhamsaremi nit: in F#, it's better not to use String.Format for string replacement, but rather sprintf, printf, failwithf, etc (please see F# tutorial for reference)

<value>Consider using a longer name, as it is currently too short.</value>
</data>
<data name="RulesIndexerAccessorStyleConsistency" xml:space="preserve">
<value>Consider switching the style for indexer accessing from OCaml to CSharp or viceversa.</value>
Copy link
Collaborator

Choose a reason for hiding this comment

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

@parhamsaremi accessing -> accessor?


## Rationale

F# 6.0 introduces a new style for indexer accessor, similar to the one in C#. But it's convenient for our codebase to be consistent in which accessor to use.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@parhamsaremi which accessor -> which accessor style


let generateOutput (range: FSharp.Compiler.Text.Range) (styleMain: string) (styleError: string) =
{ Range = range
Message = String.Format ("You must use %s styling instead of %s for indexer accessing", styleMain, styleError)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@parhamsaremi same here (please use sprintf)

@parhamsaremi parhamsaremi force-pushed the issue532-squashed-fixed branch 2 times, most recently from 51c2871 to 7cf80f6 Compare July 25, 2022 09:46
Checks for OCaml and CSharp styles. Fixes fsprojects#532
@parhamsaremi parhamsaremi force-pushed the issue532-squashed-fixed branch from 7cf80f6 to dcf2cc4 Compare July 25, 2022 10:01
@parhamsaremi parhamsaremi changed the title Add new rule IndexerAccessorStyleConsistency DRAFT: Add new rule IndexerAccessorStyleConsistency Nov 3, 2022
@parhamsaremi parhamsaremi marked this pull request as draft November 3, 2022 13:37
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.

Feature: indexing syntax consistency

2 participants