Skip to content

Commit

Permalink
Fix some linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fguillot committed Aug 9, 2022
1 parent 3eb3ac0 commit cecab91
Show file tree
Hide file tree
Showing 69 changed files with 73 additions and 176 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ updates:
- "fguillot"
assignees:
- "fguillot"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
reviewers:
- "fguillot"
assignees:
- "fguillot"
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
go-version: [1.16, 1.17, 1.18]
go-version: [1.18, 1.19]
steps:
- name: Set up Go
uses: actions/setup-go@v2
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.19
- name: Checkout
uses: actions/checkout@v2
- name: Install Postgres client
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19
- uses: golangci/golangci-lint-action@v2
with:
args: --skip-dirs tests --disable errcheck --enable sqlclosecheck --enable misspell --enable gofmt --enable goimports --enable whitespace
Expand Down
2 changes: 0 additions & 2 deletions cli/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Package cli implements command line arguments for Miniflux application.
*/
package cli // import "miniflux.app/cli"
4 changes: 1 addition & 3 deletions client/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
// license that can be found in the LICENSE file.

/*
Package client implements a client library for the Miniflux REST API.
Examples
# Examples
This code snippet fetch the list of users:
Expand All @@ -30,6 +29,5 @@ This one discover subscriptions on a website:
return
}
fmt.Println(subscriptions)
*/
package client // import "miniflux.app/client"
2 changes: 0 additions & 2 deletions config/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Package config handles configuration management for the application.
*/
package config // import "miniflux.app/config"
2 changes: 0 additions & 2 deletions crypto/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Package crypto implements helpers related to cryptography.
*/
package crypto // import "miniflux.app/crypto"
2 changes: 0 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Miniflux is a feed reader application.
*/
package main // import "miniflux.app"
2 changes: 0 additions & 2 deletions errors/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Package errors handles localized errors.
*/
package errors // import "miniflux.app/errors"
2 changes: 0 additions & 2 deletions fever/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Package fever implements Fever API endpoints.
*/
package fever // import "miniflux.app/fever"
86 changes: 42 additions & 44 deletions fever/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ func (h *handler) serve(w http.ResponseWriter, r *http.Request) {
/*
A request with the groups argument will return two additional members:
groups contains an array of group objects
feeds_groups contains an array of feeds_group objects
groups contains an array of group objects
feeds_groups contains an array of feeds_group objects
A group object has the following members:
id (positive integer)
title (utf-8 string)
id (positive integer)
title (utf-8 string)
The feeds_group object is documented under “Feeds/Groups Relationships.”
Expand All @@ -76,7 +76,6 @@ an is_spark equal to 0.
The “Sparks” super group is not included in this response and is composed of all feeds with an
is_spark equal to 1.
*/
func (h *handler) handleGroups(w http.ResponseWriter, r *http.Request) {
userID := request.UserID(r)
Expand Down Expand Up @@ -107,18 +106,18 @@ func (h *handler) handleGroups(w http.ResponseWriter, r *http.Request) {
/*
A request with the feeds argument will return two additional members:
feeds contains an array of group objects
feeds_groups contains an array of feeds_group objects
feeds contains an array of group objects
feeds_groups contains an array of feeds_group objects
A feed object has the following members:
id (positive integer)
favicon_id (positive integer)
title (utf-8 string)
url (utf-8 string)
site_url (utf-8 string)
is_spark (boolean integer)
last_updated_on_time (Unix timestamp/integer)
id (positive integer)
favicon_id (positive integer)
title (utf-8 string)
url (utf-8 string)
site_url (utf-8 string)
is_spark (boolean integer)
last_updated_on_time (Unix timestamp/integer)
The feeds_group object is documented under “Feeds/Groups Relationships.”
Expand Down Expand Up @@ -165,12 +164,12 @@ func (h *handler) handleFeeds(w http.ResponseWriter, r *http.Request) {
/*
A request with the favicons argument will return one additional member:
favicons contains an array of favicon objects
favicons contains an array of favicon objects
A favicon object has the following members:
id (positive integer)
data (base64 encoded image data; prefixed by image type)
id (positive integer)
data (base64 encoded image data; prefixed by image type)
An example data value:
Expand Down Expand Up @@ -206,20 +205,20 @@ func (h *handler) handleFavicons(w http.ResponseWriter, r *http.Request) {
/*
A request with the items argument will return two additional members:
items contains an array of item objects
total_items contains the total number of items stored in the database (added in API version 2)
items contains an array of item objects
total_items contains the total number of items stored in the database (added in API version 2)
An item object has the following members:
id (positive integer)
feed_id (positive integer)
title (utf-8 string)
author (utf-8 string)
html (utf-8 string)
url (utf-8 string)
is_saved (boolean integer)
is_read (boolean integer)
created_on_time (Unix timestamp/integer)
id (positive integer)
feed_id (positive integer)
title (utf-8 string)
author (utf-8 string)
html (utf-8 string)
url (utf-8 string)
is_saved (boolean integer)
is_read (boolean integer)
created_on_time (Unix timestamp/integer)
Most servers won’t have enough memory allocated to PHP to dump all items at once.
Three optional arguments control determine the items included in the response.
Expand All @@ -232,7 +231,6 @@ Three optional arguments control determine the items included in the response.
Use the with_ids argument with a comma-separated list of item ids to request (a maximum of 50) specific items.
(added in API version 2)
*/
func (h *handler) handleItems(w http.ResponseWriter, r *http.Request) {
var result itemsResponse
Expand Down Expand Up @@ -327,7 +325,8 @@ The unread_item_ids and saved_item_ids arguments can be used to keep your local
with the remote Fever installation.
A request with the unread_item_ids argument will return one additional member:
unread_item_ids (string/comma-separated list of positive integers)
unread_item_ids (string/comma-separated list of positive integers)
*/
func (h *handler) handleUnreadItems(w http.ResponseWriter, r *http.Request) {
userID := request.UserID(r)
Expand Down Expand Up @@ -384,9 +383,9 @@ func (h *handler) handleSavedItems(w http.ResponseWriter, r *http.Request) {
}

/*
mark=item
as=? where ? is replaced with read, saved or unsaved
id=? where ? is replaced with the id of the item to modify
mark=item
as=? where ? is replaced with read, saved or unsaved
id=? where ? is replaced with the id of the item to modify
*/
func (h *handler) handleWriteItems(w http.ResponseWriter, r *http.Request) {
userID := request.UserID(r)
Expand Down Expand Up @@ -448,10 +447,10 @@ func (h *handler) handleWriteItems(w http.ResponseWriter, r *http.Request) {
}

/*
mark=feed
as=read
id=? where ? is replaced with the id of the feed or group to modify
before=? where ? is replaced with the Unix timestamp of the the local client’s most recent items API request
mark=feed
as=read
id=? where ? is replaced with the id of the feed or group to modify
before=? where ? is replaced with the Unix timestamp of the the local client’s most recent items API request
*/
func (h *handler) handleWriteFeeds(w http.ResponseWriter, r *http.Request) {
userID := request.UserID(r)
Expand All @@ -474,10 +473,10 @@ func (h *handler) handleWriteFeeds(w http.ResponseWriter, r *http.Request) {
}

/*
mark=group
as=read
id=? where ? is replaced with the id of the feed or group to modify
before=? where ? is replaced with the Unix timestamp of the the local client’s most recent items API request
mark=group
as=read
id=? where ? is replaced with the id of the feed or group to modify
before=? where ? is replaced with the Unix timestamp of the the local client’s most recent items API request
*/
func (h *handler) handleWriteGroups(w http.ResponseWriter, r *http.Request) {
userID := request.UserID(r)
Expand Down Expand Up @@ -510,9 +509,8 @@ func (h *handler) handleWriteGroups(w http.ResponseWriter, r *http.Request) {
/*
A feeds_group object has the following members:
group_id (positive integer)
feed_ids (string/comma-separated list of positive integers)
group_id (positive integer)
feed_ids (string/comma-separated list of positive integers)
*/
func (h *handler) buildFeedGroups(feeds model.Feeds) []feedsGroups {
feedsGroupedByCategory := make(map[int64][]string)
Expand Down
5 changes: 2 additions & 3 deletions fever/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func (b *baseResponse) SetCommonValues() {
/*
The default response is a JSON object containing two members:
api_version contains the version of the API responding (positive integer)
auth whether the request was successfully authenticated (boolean integer)
api_version contains the version of the API responding (positive integer)
auth whether the request was successfully authenticated (boolean integer)
The API can also return XML by passing xml as the optional value of the api argument like so:
Expand All @@ -37,7 +37,6 @@ at least one additional member:
last_refreshed_on_time contains the time of the most recently refreshed (not updated)
feed (Unix timestamp/integer)
*/
func newBaseResponse() baseResponse {
r := baseResponse{}
Expand Down
2 changes: 0 additions & 2 deletions googlereader/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Package googlereader implements Google Reader API endpoints.
*/
package googlereader // import "miniflux.app/googlereader"
15 changes: 4 additions & 11 deletions http/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ const (
)

var (
errInvalidCertificate = "Invalid SSL certificate (original error: %q)"
errTemporaryNetworkOperation = "This website is temporarily unreachable (original error: %q)"
errPermanentNetworkOperation = "This website is permanently unreachable (original error: %q)"
errRequestTimeout = "Website unreachable, the request timed out after %d seconds"
errInvalidCertificate = "Invalid SSL certificate (original error: %q)"
errNetworkOperation = "This website is unreachable (original error: %q)"
errRequestTimeout = "Website unreachable, the request timed out after %d seconds"
)

// Client builds and executes HTTP requests.
Expand Down Expand Up @@ -205,17 +204,11 @@ func (c *Client) executeRequest(request *http.Request) (*Response, error) {
case x509.CertificateInvalidError, x509.HostnameError:
err = errors.NewLocalizedError(errInvalidCertificate, uerr.Err)
case *net.OpError:
if uerr.Err.(*net.OpError).Temporary() {
err = errors.NewLocalizedError(errTemporaryNetworkOperation, uerr.Err)
} else {
err = errors.NewLocalizedError(errPermanentNetworkOperation, uerr.Err)
}
err = errors.NewLocalizedError(errNetworkOperation, uerr.Err)
case net.Error:
nerr := uerr.Err.(net.Error)
if nerr.Timeout() {
err = errors.NewLocalizedError(errRequestTimeout, c.ClientTimeout)
} else if nerr.Temporary() {
err = errors.NewLocalizedError(errTemporaryNetworkOperation, nerr)
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions http/client/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Package client provides an HTTP client builder.
*/
package client // import "miniflux.app/http/client"
2 changes: 0 additions & 2 deletions http/cookie/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Package cookie provides functions to build cookies.
*/
package cookie // import "miniflux.app/http/cookie"
2 changes: 0 additions & 2 deletions http/request/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Package request contains helper functions to work with the HTTP request.
*/
package request // import "miniflux.app/http/request"
2 changes: 0 additions & 2 deletions http/response/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Package response contains everything related to HTTP responses.
*/
package response // import "miniflux.app/http/response"
2 changes: 0 additions & 2 deletions http/response/html/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.

/*
Package html contains HTML response functions.
*/
package html // import "miniflux.app/http/response/html"
Loading

0 comments on commit cecab91

Please sign in to comment.