Skip to content

Commit

Permalink
This commit is an attempt to remove the usage of the terminology "bla…
Browse files Browse the repository at this point in the history
…cklist" within

this project and rather use an inclusive terminology that is acceptable to wider audience (devs/users)
without running into the danger of hurting sentiments and doing away with colonial-era
terminology.

As an example, https://thenewstack.io/words-matter-finally-tech-looks-at-removing-exclusionary-language/
  • Loading branch information
ruhullahshah committed Feb 6, 2023
1 parent b4ce66f commit 3bd63bf
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
24 changes: 12 additions & 12 deletions src/Paket.Core/Dependencies/NuGetCache.fs
Original file line number Diff line number Diff line change
Expand Up @@ -645,20 +645,20 @@ type UrlToTry =
type BlockedCacheEntry =
{ BlockedFormats : string list }

let private tryUrlOrBlacklistI =
let tryUrlOrBlacklistInner (f : unit -> Async<obj>, isOk : obj -> bool) cacheKey =
let private tryUrlOrIgnoreI =
let tryUrlOrIgnoreInner (f : unit -> Async<obj>, isOk : obj -> bool) cacheKey =
async {
//try
let! res = f ()
return isOk res, res
}
let memoizedBlackList = memoizeAsyncEx tryUrlOrBlacklistInner
let memoizedIgnoreList = memoizeAsyncEx tryUrlOrIgnoreInner
fun f isOk cacheKey ->
memoizedBlackList (f, isOk) cacheKey
memoizedIgnoreList (f, isOk) cacheKey

let private tryUrlOrBlacklist (f: _ -> Async<'a>) (isOk : 'a -> bool) (source:NuGetSource, id:UrlId) =
let private tryUrlOrIgnore (f: _ -> Async<'a>) (isOk : 'a -> bool) (source:NuGetSource, id:UrlId) =
let res =
tryUrlOrBlacklistI
tryUrlOrIgnoreI
(fun s -> async { let! r = f s in return box r })
(fun s -> isOk (s :?> 'a))
(source,id)
Expand All @@ -669,15 +669,15 @@ let private tryUrlOrBlacklist (f: _ -> Async<'a>) (isOk : 'a -> bool) (source:Nu

type QueryResult = Choice<ODataSearchResult,System.Exception>

let tryAndBlacklistUrl doBlackList doWarn (source:NuGetSource)
let tryAndIgnoreUrl doIgnore doWarn (source:NuGetSource)
(tryAgain : QueryResult -> bool) (f : string -> Async<QueryResult>) (urls: UrlToTry list) : Async<QueryResult>=
async {
let! tasks, resultIndex =
urls
|> Seq.map (fun url -> async {
let cached =
if doBlackList then
tryUrlOrBlacklist (fun () -> async { return! f url.InstanceUrl }) (tryAgain >> not) (source, url.UrlId)
if doIgnore then
tryUrlOrIgnore (fun () -> async { return! f url.InstanceUrl }) (tryAgain >> not) (source, url.UrlId)
else
async {
let! result = f url.InstanceUrl
Expand All @@ -690,12 +690,12 @@ let tryAndBlacklistUrl doBlackList doWarn (source:NuGetSource)
let! result = f url.InstanceUrl
return Choice1Of3 result
else
return Choice3Of3 () // Url Blacklisted
return Choice3Of3 () // Url Ignored
| FirstCall task ->
let! isOk, res = task |> Async.AwaitTask
if not isOk then
if doWarn then
traceWarnIfNotBefore url.InstanceUrl "Possible Performance degradation, blacklist '%s'" url.InstanceUrl
traceWarnIfNotBefore url.InstanceUrl "Possible Performance degradation, ignore '%s'" url.InstanceUrl
return Choice2Of3 res
else
return Choice1Of3 res
Expand Down Expand Up @@ -736,5 +736,5 @@ let tryAndBlacklistUrl doBlackList doWarn (source:NuGetSource)
| Some res -> res
| None ->
let urls = urls |> Seq.map (fun u -> u.InstanceUrl) |> fun s -> String.Join("\r\t - ", s)
failwithf "All possible sources are already blacklisted. \r\t - %s" urls
failwithf "All possible sources are already ignored. \r\t - %s" urls
}
4 changes: 2 additions & 2 deletions src/Paket.Core/Dependencies/NuGetV2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ let parseODataEntryDetails (url,nugetURL,packageName:PackageName,version:SemVerI


let getDetailsFromNuGetViaODataFast isVersionAssumed nugetSource (packageName:PackageName) (version:SemVerInfo) =
let doBlacklist = not isVersionAssumed
let doIgnore = not isVersionAssumed
async {
let normalizedVersion = version.Normalize()
let urls =
Expand Down Expand Up @@ -377,7 +377,7 @@ let getDetailsFromNuGetViaODataFast isVersionAssumed nugetSource (packageName:Pa
| Choice1Of2 _ -> false
| _ -> true

let! result = NuGetCache.tryAndBlacklistUrl doBlacklist true nugetSource tryAgain handleUrl urls
let! result = NuGetCache.tryAndIgnoreUrl doIgnore true nugetSource tryAgain handleUrl urls
match result with
| Choice1Of2 res -> return res
| Choice2Of2 ex -> return raise (exn("error", ex))
Expand Down
6 changes: 3 additions & 3 deletions src/Paket.Core/Installation/InstallProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ let findPackageFolder root (groupName,packageName) (version,settings) =
failwithf "Package directory for package %O was not found in %s. Storage mode is \"none\"." packageName d.FullName
d

let contentFileBlackList : list<FileInfo -> bool> = [
let contentFileIgnoreList : list<FileInfo -> bool> = [
fun f -> f.Name = "_._"
fun f -> f.Name.EndsWith ".transform"
fun f -> f.Name.EndsWith ".pp"
Expand Down Expand Up @@ -112,7 +112,7 @@ let processContentFiles root project (usedPackages:Map<_,_>) gitRemoteItems opti
|> Seq.toList

let copyContentFiles (project : ProjectFile, packagesWithContent) =
let onBlackList (fi : FileInfo) = contentFileBlackList |> List.exists (fun rule -> rule(fi))
let onIgnoreList (fi : FileInfo) = contentFileIgnoreList |> List.exists (fun rule -> rule(fi))

let rec copyDirContents (fromDir : DirectoryInfo, contentCopySettings, toDir : Lazy<DirectoryInfo>) =
fromDir.GetDirectories() |> Array.toList
Expand All @@ -121,7 +121,7 @@ let processContentFiles root project (usedPackages:Map<_,_>) gitRemoteItems opti
(fromDir.GetFiles()
|> Array.toList
|> List.filter (fun file ->
if onBlackList file then false else
if onIgnoreList file then false else
if file.Name = "paket.references" then traceWarnfn "You can't use paket.references as a content file in the root of a project. Please take a look at %s" file.FullName; false else true)
|> List.map (fun file ->
let overwrite = contentCopySettings = ContentCopySettings.Overwrite
Expand Down
8 changes: 4 additions & 4 deletions src/Paket.Core/PaketConfigFiles/InstallModel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ module InstallModel =
let targetsFile = t.Path
(String.endsWithIgnoreCase (sprintf "%s.props" installModel.PackageName.Name) targetsFile||
String.endsWithIgnoreCase (sprintf "%s.targets" installModel.PackageName.Name) targetsFile)))
let filterBlackList = filterUnknownFiles
let filterIgnoreList = filterUnknownFiles

let applyFrameworkRestrictions (restriction:FrameworkRestriction) (installModel:InstallModel) =
match restriction with
Expand Down Expand Up @@ -960,7 +960,7 @@ module InstallModel =
let createFromContent packageName packageVersion kind frameworkRestrictions content =
emptyModel packageName packageVersion kind
|> addNuGetFiles content
|> filterBlackList
|> filterIgnoreList
|> applyFrameworkRestrictions frameworkRestrictions
|> removeIfCompletelyEmpty

Expand All @@ -972,7 +972,7 @@ module InstallModel =
|> addAnalyzerFiles analyzerFiles
|> addPackageLoadScriptFiles packageLoadScriptFiles
|> addFrameworkAssemblyReferences nuspec.FrameworkAssemblyReferences
|> filterBlackList
|> filterIgnoreList
|> applyFrameworkRestrictions frameworkRestrictions
|> removeIfCompletelyEmpty
|> addLicense nuspec.LicenseUrl
Expand Down Expand Up @@ -1052,7 +1052,7 @@ type InstallModel with

member this.AddFrameworkAssemblyReferences references = InstallModel.addFrameworkAssemblyReferences references this

member this.FilterBlackList () = InstallModel.filterBlackList this
member this.FilterIgnoreList () = InstallModel.filterIgnoreList this

member this.FilterExcludes excludes = InstallModel.filterExcludes excludes this

Expand Down
18 changes: 9 additions & 9 deletions tests/Paket.Tests/InstallModel/ProcessingSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,10 @@ let ``should skip buckets which contain placeholder while adjusting upper versio
|> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Rx-Main\lib\net20\Rx.dll"

[<Test>]
let ``should filter _._ when processing blacklist``() =
let ``should filter _._ when processing ignore list``() =
let model =
emptymodel.AddReferences([ @"..\Rx-Main\lib\net40\_._"; @"..\Rx-Main\lib\net20\_._" ] |> fromLegacyList @"..\Rx-Main\")
.FilterBlackList()
.FilterIgnoreList()

model.GetLegacyReferences(TargetProfile.SinglePlatform (DotNetFramework FrameworkVersion.V2))
|> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Rx-Main\lib\net20\_._"
Expand Down Expand Up @@ -406,7 +406,7 @@ let ``should handle lib install of Microsoft.BCL for NET >= 40``() =
@"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll"

@"..\Microsoft.Bcl\lib\net45\_._" ] |> fromLegacyList @"..\Microsoft.Bcl\")
.FilterBlackList()
.FilterIgnoreList()

model.GetLegacyReferences(TargetProfile.SinglePlatform (DotNetFramework FrameworkVersion.V3_5))
|> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Microsoft.Bcl\lib\net40\System.IO.dll"
Expand All @@ -432,7 +432,7 @@ let ``should skip lib install of Microsoft.BCL for monotouch and monoandroid``()
@"..\Microsoft.Bcl\lib\monoandroid\_._"
@"..\Microsoft.Bcl\lib\monotouch\_._"
@"..\Microsoft.Bcl\lib\net45\_._" ] |> fromLegacyList @"..\Microsoft.Bcl\")
.FilterBlackList()
.FilterIgnoreList()

model.GetLegacyReferences(TargetProfile.SinglePlatform (MonoAndroid MonoAndroidVersion.V1)) |> shouldBeEmpty
model.GetLegacyReferences(TargetProfile.SinglePlatform MonoTouch) |> shouldBeEmpty
Expand Down Expand Up @@ -611,7 +611,7 @@ let ``should handle lib install of MicrosoftBcl``() =
@"..\Microsoft.Bcl\lib\wpa81\_._"
@"..\Microsoft.Bcl\lib\portable-net451+win81\_._"
@"..\Microsoft.Bcl\lib\portable-net451+win81+wpa81\_._"]
|> fromLegacyList @"..\Microsoft.Bcl\")).FilterBlackList()
|> fromLegacyList @"..\Microsoft.Bcl\")).FilterIgnoreList()

model.GetLegacyReferences(TargetProfile.SinglePlatform (DotNetFramework FrameworkVersion.V4))
|> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.IO.dll"
Expand Down Expand Up @@ -726,7 +726,7 @@ let ``should only handle dll and exe files``() =
@"..\Fantomas\lib\FSharp.Core.dll"
@"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList @"..\Fantomas\",
NuspecReferences.All)
.FilterBlackList()
.FilterIgnoreList()

model.GetLegacyReferences(TargetProfile.SinglePlatform (DotNetFramework FrameworkVersion.V2))
|> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll"
Expand Down Expand Up @@ -773,7 +773,7 @@ let ``should handle props files``() =
InstallModel.EmptyModel(PackageName "xunit.runner.visualstudio",SemVer.Parse "0.1").AddTargetsFiles(
[ @"..\xunit.runner.visualstudio\build\net20\xunit.runner.visualstudio.props"
@"..\xunit.runner.visualstudio\build\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.runner.visualstudio.props" ] |> fromLegacyList @"..\xunit.runner.visualstudio\")
.FilterBlackList()
.FilterIgnoreList()

model.GetTargetsFiles(TargetProfile.SinglePlatform (DotNetFramework FrameworkVersion.V2))
|> Seq.map (fun f -> f.Path) |> shouldContain @"..\xunit.runner.visualstudio\build\net20\xunit.runner.visualstudio.props"
Expand All @@ -784,7 +784,7 @@ let ``should handle global props files``() =
InstallModel.EmptyModel(PackageName "xunit.runner.visualstudio",SemVer.Parse "0.1").AddTargetsFiles(
[ @"..\xunit.runner.visualstudio\build\xunit.runner.visualstudio.props"
@"..\xunit.runner.visualstudio\build\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.runner.visualstudio.props" ] |> fromLegacyList @"..\xunit.runner.visualstudio\")
.FilterBlackList()
.FilterIgnoreList()

model.GetTargetsFiles(TargetProfile.SinglePlatform (DotNetFramework FrameworkVersion.V2))
|> Seq.map (fun f -> f.Path) |> shouldContain @"..\xunit.runner.visualstudio\build\xunit.runner.visualstudio.props"
Expand All @@ -794,7 +794,7 @@ let ``should handle Targets files``() =
let model =
InstallModel.EmptyModel(PackageName "StyleCop.MSBuild",SemVer.Parse "0.1").AddTargetsFiles(
[ @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" ] |> fromLegacyList @"..\StyleCop.MSBuild\")
.FilterBlackList()
.FilterIgnoreList()

model.GetTargetsFiles(TargetProfile.SinglePlatform (DotNetFramework FrameworkVersion.V2))
|> Seq.map (fun f -> f.Path) |> shouldContain @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets"
Expand Down
2 changes: 1 addition & 1 deletion tests/Playlists/paket.tests.playlist

Large diffs are not rendered by default.

0 comments on commit 3bd63bf

Please sign in to comment.