Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mtorpey committed Sep 5, 2024
1 parent f2bf481 commit dfcbb1c
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 26 deletions.
6 changes: 1 addition & 5 deletions .gaplint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
columns: 80
columns: 120
disable:
- no-space-after-comment
- align-assignments
- whitespace-op-negative
- space-before-bracket
- space-after-bracket
16 changes: 8 additions & 8 deletions gap/PackageManager.gi
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function(string, args...)
version := args[1];
interactive := args[2];
fi;

# Tidy up the string
NormalizeWhitespace(string);

Expand All @@ -57,7 +57,7 @@ end);
InstallGlobalFunction(RemovePackage,
function(name, interactive...)
local info, dir, q;

# Check input
if not IsString(name) then
ErrorNoReturn("PackageManager: RemovePackage: <name> must be a string");
Expand All @@ -78,7 +78,7 @@ function(name, interactive...)

# Locate the package
info := PKGMAN_UserPackageInfo(name : warnIfNone, warnIfMultiple);

# Need precisely one version
if Length(info) <> 1 then
return false;
Expand All @@ -97,8 +97,8 @@ end);

InstallGlobalFunction(UpdatePackage,
function(name, interactive...)
local user_pkg_dir, info, dirs, vc, repo, dir, status, pull, line, urls,
newest, old, oldVer, olddir, q;
local info, dirs, vc, repo, dir, status, pull, line, urls, newest, old,
oldVer, olddir, q;

# Check input
if not IsString(name) then
Expand All @@ -118,10 +118,10 @@ function(name, interactive...)
else
interactive := true;
fi;

# Package names should be case-insensitive
name := LowercaseString(name);

# Locate the package
info := PKGMAN_UserPackageInfo(name : warnIfNone);

Expand Down Expand Up @@ -336,7 +336,7 @@ function(name)
local dir, path;

for dir in DirectoriesSystemPrograms() do
path:= Filename(dir, name);
path := Filename(dir, name);
if IsExecutableFile(path) then
return path;
fi;
Expand Down
7 changes: 4 additions & 3 deletions gap/distro.gd
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ DeclareGlobalFunction("InstallRequiredPackages");
DeclareGlobalFunction("GetPackageURLs");
DeclareGlobalFunction("PKGMAN_InstallDependencies");

PKGMAN_PackageInfoURLList := # Source of latest package releases
Concatenation("https://github.com/gap-system/PackageDistro/",
"releases/download/latest/pkglist.csv");
# Source of latest package releases
PKGMAN_PackageInfoURLList :=
"https://github.com/gap-system/PackageDistro/releases/download/latest/pkglist.csv";

PKGMAN_InstallQueue := []; # Queue of dependencies to install
PKGMAN_MarkedForInstall := []; # Packages currently halfway through installing
4 changes: 2 additions & 2 deletions gap/distro.gi
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function(name, args...)
newest := PKGMAN_DownloadPackageInfo(urls.(name));
if version <> true then
# Update or give up, but do not ask questions.
if CompareVersionNumbers( newest.Version, version ) then
if CompareVersionNumbers(newest.Version, version) then
# Updating to the newest version will satisfy the version condition.
return UpdatePackage(name, interactive);
else
Expand Down Expand Up @@ -137,7 +137,7 @@ function()
elif Length(items) = 1 or Length(items) > 3
or (Length(items) = 3 and items[2] <> "MOVE") then
if Length(line) > 74 then # don't show too much
line := Concatenation(line{[1..71]}, "...");
line := Concatenation(line{[1 .. 71]}, "...");
fi;
Info(InfoPackageManager, 1,
"PackageManager: GetPackageURLs: bad line:\n#I ", line);
Expand Down
4 changes: 2 additions & 2 deletions gap/download.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ PKGMAN_CurlIntReqVer :=
item -> item[1] = "curlInterface")[2];

# Shell commands used for downloading if curlInterface not loaded
PKGMAN_DownloadCmds := [ [ "wget", ["--quiet", "-O", "-"] ],
[ "curl", ["--silent", "-L", "--output", "-"] ] ];
PKGMAN_DownloadCmds := [["wget", ["--quiet", "-O", "-"]],
["curl", ["--silent", "-L", "--output", "-"]]];
2 changes: 1 addition & 1 deletion gap/git.gi
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function(url)
return parts[n];
fi;
if parts[n] = "git" and n > 1 then
return parts[n-1];
return parts[n - 1];
fi;
return fail;
end);
2 changes: 1 addition & 1 deletion gap/hg.gi
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function(url)
return parts[n];
fi;
if parts[n] = "hg" and n > 1 then
return parts[n-1];
return parts[n - 1];
fi;
return fail;
end);
8 changes: 4 additions & 4 deletions gap/packageinfo.gi
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ end);
InstallGlobalFunction(PKGMAN_UserPackageInfo,
function(name)
local user_pkg_dir, allinfo, userinfo;

user_pkg_dir := PKGMAN_PackageDir();
allinfo := PackageInfo(name);
userinfo := Filtered(allinfo, i -> StartsWith(i.InstallationPath, user_pkg_dir));

# Package not found
if ValueOption("warnIfNone") = true and Length(userinfo) = 0 then
Info(InfoPackageManager, 1, "Package \"", name, "\" not installed in user package directory");
Expand All @@ -95,12 +95,12 @@ function(name)
Info(InfoPackageManager, 2, "but installed at ", List(allinfo, i -> i.InstallationPath));
fi;
fi;

# Multiple versions found
if ValueOption("warnIfMultiple") = true and Length(userinfo) > 1 then
Info(InfoPackageManager, 1, "Multiple versions of package ", name, " installed");
Info(InfoPackageManager, 2, "at ", List(userinfo, i -> i.InstallationPath));
fi;

return userinfo;
end);

0 comments on commit dfcbb1c

Please sign in to comment.