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

Clean up #24

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"version": 1,
"isRoot": true,
"tools": {
"fantomas-tool": {
"version": "4.6.0-beta-001",
"fantomas": {
"version": "6.3.0-alpha-003",
"commands": [
"fantomas"
]
Expand Down
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*.{fs,fsi,fsx}]
end_of_line = lf
fsharp_keep_max_number_of_blank_lines = 1
fsharp_multi_line_lambda_closing_newline = true
fsharp_alternative_long_member_definitions = true
fsharp_align_function_signature_to_indentation = true
fsharp_experimental_keep_indent_in_branch = true
fsharp_bar_before_discriminated_union_declaration = true
fsharp_multiline_bracket_style = aligned

# Expecto looks a bit nicer with stroustrup
[test/**/*.fs]
fsharp_multiline_bracket_style = stroustrup
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Automatically normalize line endings
* text=auto

# Always use lf for F# files
*.fs text eol=lf
*.fsx text eol=lf
*.fsi text eol=lf
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "daily"
ignore:
- dependency-name: "FSharp.Core"
4 changes: 4 additions & 0 deletions .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- name: Tool restore
run: dotnet tool restore
- name: Format Check
run: dotnet fantomas . --check || echo "The code was not formatted, run `dotnet fantomas .` to format all code."
- name: Restore
run: dotnet restore
- name: Run Build
Expand Down
5 changes: 5 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
<PackageTags>version;changelog;keepachangelog</PackageTags>
<GeneratePathProperty>true</GeneratePathProperty>
<PackageIcon>ionide.png</PackageIcon>
<NoWarn>$(NoWarn);3186,0042</NoWarn><!-- circumvent an error with the fake dependencymanager for paket: https://github.com/dotnet/fsharp/issues/8678 -->
<NoWarn>$(NoWarn);NU1902</NoWarn><!-- NU1902 - package vulnerability detected -->
<WarnOn>$(WarnOn);1182</WarnOn> <!-- Unused variables,https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-options#opt-in-warnings -->
<WarnOn>$(WarnOn);3390</WarnOn><!-- Malformed XML doc comments -->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dotnet.ReproducibleBuilds" Version="1.1.1" PrivateAssets="All" />
Expand Down
26 changes: 14 additions & 12 deletions src/Ionide.KeepAChangelog.Tasks/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ module Util =
item.SetMetadata("Removed", data.Removed)
item.SetMetadata("Fixed", data.Fixed)
item.SetMetadata("Security", data.Security)
for (KeyValue(heading, lines)) in data.Custom do

for KeyValue(heading, lines) in data.Custom do
item.SetMetadata(heading, lines)

item

type ParseChangelogs() =
Expand All @@ -41,7 +43,7 @@ type ParseChangelogs() =
member val CurrentReleaseChangelog: ITaskItem = null with get, set

[<Output>]
member val AllReleasedChangelogs: ITaskItem [] = null with get, set
member val AllReleasedChangelogs: ITaskItem array = null with get, set

[<Output>]
member val LatestReleaseNotes: string = null with get, set
Expand All @@ -58,9 +60,8 @@ type ParseChangelogs() =
changelogs.Unreleased
|> Option.iter (fun unreleased ->
this.UnreleasedChangelog <-
TaskItem()
|> Util.mapChangelogData unreleased
|> Util.mapUnreleasedInfo)
TaskItem() |> Util.mapChangelogData unreleased |> Util.mapUnreleasedInfo
)

let sortedReleases =
// have to use LINQ here because List.sortBy* require IComparable, which
Expand All @@ -72,7 +73,10 @@ type ParseChangelogs() =
|> Seq.map (fun (version, date, data) ->
TaskItem()
|> Util.mapReleaseInfo version date
|> fun d -> match data with Some data -> Util.mapChangelogData data d | None -> d
|> fun d ->
match data with
| Some data -> Util.mapChangelogData data d
| None -> d
)
|> Seq.toArray

Expand All @@ -81,14 +85,12 @@ type ParseChangelogs() =

sortedReleases
|> Seq.tryHead
|> Option.iter (fun (version, date, data) ->
data
|> Option.iter (fun data ->
this.LatestReleaseNotes <- data.ToMarkdown())
)
|> Option.iter (fun (_version, _date, data) ->
data |> Option.iter (fun data -> this.LatestReleaseNotes <- data.ToMarkdown())
)

true
| Error (formatted, msg) ->
| Error(formatted, msg) ->

this.Log.LogError(
$"Error parsing Changelog at {file.FullName}. The error occurred at {msg.Position}.{System.Environment.NewLine}{formatted}"
Expand Down
Loading
Loading