Skip to content

Commit

Permalink
Merge pull request #1138 from alainm23/fix_lint
Browse files Browse the repository at this point in the history
[lint]: fix lints
  • Loading branch information
alainm23 authored Feb 21, 2024
2 parents 1ffa5ab + 4104ffe commit 5057ea2
Show file tree
Hide file tree
Showing 33 changed files with 114 additions and 101 deletions.
2 changes: 1 addition & 1 deletion core/Objects/Project.vala
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public class Objects.Project : Objects.BaseObject {

Services.CalDAV.get_default ().update_tasklist.begin (this, (obj, res) => {
Services.CalDAV.get_default ().update_tasklist.end (res);
Services.Database.get_default().update_project (this);
Services.Database.get_default ().update_project (this);
loading = false;
});
}
Expand Down
2 changes: 1 addition & 1 deletion core/Objects/Promise.vala
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ public class Services.Promise<T> : Object {
public void reject (string error) {
rejected (error);
}
}
}
26 changes: 16 additions & 10 deletions core/Services/CalDAV.vala
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class Services.CalDAV : GLib.Object {

private uint server_timeout = 0;

// vala-lint=naming-convention
public static string USER_PRINCIPAL_REQUEST = """
<d:propfind xmlns:d="DAV:">
<d:prop>
Expand All @@ -52,6 +53,7 @@ public class Services.CalDAV : GLib.Object {
</d:propfind>
""";

// vala-lint=naming-convention
public static string USER_DATA_REQUEST = """
<x0:propfind xmlns:x0="DAV:">
<x0:prop>
Expand All @@ -61,6 +63,7 @@ public class Services.CalDAV : GLib.Object {
</x0:propfind>
""";
// vala-lint=naming-convention
public static string TASKLIST_REQUEST = """
<x0:propfind xmlns:x0="DAV:">
<x0:prop>
Expand Down Expand Up @@ -202,8 +205,9 @@ public class Services.CalDAV : GLib.Object {
<x0:current-user-privilege-set/>
</x0:prop>
</x0:propfind>
""";
""";
// vala-lint=naming-convention
public static string CREATE_TASKLIST_REQUEST = """
<x0:mkcol xmlns:x0="DAV:">
<x0:set>
Expand All @@ -221,8 +225,9 @@ public class Services.CalDAV : GLib.Object {
</x0:prop>
</x0:set>
</x0:mkcol>
""";
""";
// vala-lint=naming-convention
public static string UPDATE_TASKLIST_REQUEST = """
<x0:propertyupdate xmlns:x0="DAV:">
<x0:set>
Expand All @@ -232,8 +237,9 @@ public class Services.CalDAV : GLib.Object {
</x0:prop>
</x0:set>
</x0:propertyupdate>
""";
""";
// vala-lint=naming-convention
public static string TASKS_REQUEST = """
<x1:calendar-query xmlns:x1="urn:ietf:params:xml:ns:caldav">
<x0:prop xmlns:x0="DAV:">
Expand Down Expand Up @@ -291,8 +297,8 @@ public class Services.CalDAV : GLib.Object {
public async HttpResponse login (string server_url, string username, string password) {
var url = "%s/remote.php/dav/".printf (server_url);
string credentials = "%s:%s".printf(username, password);
string base64_credentials = Base64.encode(credentials.data);
string credentials = "%s:%s".printf (username, password);
string base64_credentials = Base64.encode (credentials.data);

var message = new Soup.Message ("PROPFIND", url);
message.request_headers.append ("Authorization", "Basic %s".printf (base64_credentials));
Expand Down Expand Up @@ -928,8 +934,8 @@ public class Services.CalDAV : GLib.Object {
private async void set_credential (Soup.Message message) {
string username = Services.Settings.get_default ().settings.get_string ("caldav-username");
string password = yield Secret.password_lookupv (schema, get_attributes (), null);
string credentials = "%s:%s".printf(username, password);
string base64_credentials = Base64.encode(credentials.data);
string credentials = "%s:%s".printf (username, password);
string base64_credentials = Base64.encode (credentials.data);
message.request_headers.append ("Authorization", "Basic %s".printf (base64_credentials));
}
}
4 changes: 2 additions & 2 deletions core/Services/Chrono/Chrono.vala
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public class Chrono.Parse : GLib.Object {
}
}

public void parse(string text) {
public void parse (string text) {
Gee.ArrayList<Chrono.ParsingResult> results = new Gee.ArrayList<Chrono.ParsingResult> ();

GLib.MatchInfo match;
foreach (Chrono.AbstractParser parser in configuration.parsers) {
if (parser.inner_pattern ().match_all (text, 0, out match)) {
Chrono.ParsingResult result = parser.inner_extract (match);
Chrono.ParsingResult result = parser.inner_extract (match);
results.add (result);
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/Services/Chrono/Locales/En/En.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public class Chrono.En.Parse : Chrono.Configuration {
construct {
parsers.add (new Chrono.En.ENCasualDateParser ());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
*/

public class Chrono.En.ENCasualDateParser : GLib.Object, Chrono.AbstractParser {
GLib.Regex PATTERN = /(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/;
GLib.Regex PATTERN = /(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/; // vala-lint=naming-convention, space-before-paren

public GLib.Regex inner_pattern () {
return PATTERN;
}

public Chrono.ParsingResult inner_extract (GLib.MatchInfo match) {
var component = new Chrono.ParsingResult ();
var lowerText = match.fetch_all () [0].down ();
var lowerText = match.fetch_all () [0].down (); // vala-lint=naming-convention
component.text = lowerText;

switch (lowerText) {
Expand All @@ -53,4 +53,4 @@ public class Chrono.En.ENCasualDateParser : GLib.Object, Chrono.AbstractParser {

return component;
}
}
}
2 changes: 1 addition & 1 deletion core/Services/Chrono/Types.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ public class Chrono.ParsingResult : GLib.Object {
public int index { get; set; default = 0; }
public string text { get; set; default = ""; }
public GLib.DateTime? datetime { get; set; default = null; }
}
}
2 changes: 1 addition & 1 deletion core/Services/Database.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2017,7 +2017,7 @@ public class Services.Database : GLib.Object {
warning ("Error: %d: %s", db.errcode (), db.errmsg ());
}

stmt.reset();
stmt.reset ();
}

public void clear_queue () {
Expand Down
44 changes: 22 additions & 22 deletions core/Widgets/CircularProgressBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Widgets.CircularProgressBar : Adw.Bin {
}
}

private _CircularProgressBar circularProgressBar;
private _CircularProgressBar circularProgressBar; // vala-lint=naming-convention

public CircularProgressBar (int size = 18) {
Object (
Expand All @@ -48,7 +48,7 @@ public class Widgets.CircularProgressBar : Adw.Bin {
add_css_class ("circular-progress-bar");
}

circularProgressBar = new _CircularProgressBar(size) {
circularProgressBar = new _CircularProgressBar (size) {
margin_start = 2,
margin_top = 2,
margin_end = 2,
Expand All @@ -59,7 +59,7 @@ public class Widgets.CircularProgressBar : Adw.Bin {
}
}

public class _CircularProgressBar : Gtk.DrawingArea {
public class _CircularProgressBar : Gtk.DrawingArea { // vala-lint=naming-convention
public int size { get; construct; }

private int _line_width;
Expand All @@ -68,19 +68,19 @@ public class _CircularProgressBar : Gtk.DrawingArea {
private string _radius_fill_color;
private string _progress_fill_color;

[Description(nick = "Center Fill", blurb = "Center Fill toggle")]
[Description (nick = "Center Fill", blurb = "Center Fill toggle")]
public bool center_filled {set; get; default = false;}

[Description(nick = "Radius Fill", blurb = "Radius Fill toggle")]
[Description (nick = "Radius Fill", blurb = "Radius Fill toggle")]
public bool radius_filled {set; get; default = false;}

[Description(nick = "Font", blurb = "Font description without size, just the font name")]
[Description (nick = "Font", blurb = "Font description without size, just the font name")]
public string font {set; get; default = "URW Gothic";}

[Description(nick = "Line Cap", blurb = "Line Cap for stroke as in Cairo.LineCap")]
[Description (nick = "Line Cap", blurb = "Line Cap for stroke as in Cairo.LineCap")]
public Cairo.LineCap line_cap {set; get; default = Cairo.LineCap.BUTT;}

[Description(nick = "Inside circle fill color", blurb = "Center pad fill color (Check Gdk.RGBA parse method)")]
[Description (nick = "Inside circle fill color", blurb = "Center pad fill color (Check Gdk.RGBA parse method)")]
public string center_fill_color {
get {
return _center_fill_color;
Expand All @@ -93,7 +93,7 @@ public class _CircularProgressBar : Gtk.DrawingArea {
}
}

[Description(nick = "Circular radius fill color", blurb = "The circular pad fill color (Check GdkRGBA parse method)")]
[Description (nick = "Circular radius fill color", blurb = "The circular pad fill color (Check GdkRGBA parse method)")]
public string radius_fill_color {
get {
return _radius_fill_color;
Expand All @@ -106,10 +106,10 @@ public class _CircularProgressBar : Gtk.DrawingArea {
}
}

[Description(nick = "Progress fill color", blurb = "Progress line color (Check GdkRGBA parse method)")]
[Description (nick = "Progress fill color", blurb = "Progress line color (Check GdkRGBA parse method)")]
public string progress_fill_color {
get {
return _progress_fill_color;;
return _progress_fill_color;
}
set {
var color = Gdk.RGBA ();
Expand All @@ -119,7 +119,7 @@ public class _CircularProgressBar : Gtk.DrawingArea {
}
}

[Description(nick = "Circle width", blurb = "The circle radius line width")]
[Description (nick = "Circle width", blurb = "The circle radius line width")]
public int line_width {
get {
return _line_width;
Expand All @@ -135,7 +135,7 @@ public class _CircularProgressBar : Gtk.DrawingArea {
}
}

[Description(nick = "Percentage/Value", blurb = "The percentage value [0.0 ... 1.0]")]
[Description (nick = "Percentage/Value", blurb = "The percentage value [0.0 ... 1.0]")]
public double percentage {
get {
return _percentage;
Expand All @@ -154,19 +154,19 @@ public class _CircularProgressBar : Gtk.DrawingArea {
construct {
_line_width = 0;
_percentage = 0;
_center_fill_color = "#adadad";
_radius_fill_color = "#d3d3d3";
_center_fill_color = "#adadad"; // vala-lint=double-spaces
_radius_fill_color = "#d3d3d3"; // vala-lint=double-spaces
_progress_fill_color = "#4a90d9";
}

public _CircularProgressBar (int size) {
Object(
Object (
size: size,
height_request: size,
width_request: size
);

set_draw_func(draw);
set_draw_func (draw);

notify.connect (() => {
queue_draw ();
Expand All @@ -191,7 +191,7 @@ public class _CircularProgressBar : Gtk.DrawingArea {

var center_x = get_width () / 2;
var center_y = get_height () / 2;
var radius = calculate_radius ();
var radius = calculate_radius ();

if (radius - line_width < 0) {
delta = 0;
Expand All @@ -201,7 +201,7 @@ public class _CircularProgressBar : Gtk.DrawingArea {
}

color = Gdk.RGBA ();
cr.set_line_cap (line_cap);
cr.set_line_cap (line_cap);
cr.set_line_width (line_width);

// Center Fill
Expand Down Expand Up @@ -229,15 +229,15 @@ public class _CircularProgressBar : Gtk.DrawingArea {
cr.move_to (center_x, center_y);
cr.arc (center_x,
center_y,
delta+1,
1.5 * Math.PI,
delta + 1,
1.5 * Math.PI,
(1.5 + percentage * 2 ) * Math.PI);
cr.fill ();
} else {
cr.arc (center_x,
center_y,
delta,
1.5 * Math.PI,
1.5 * Math.PI,
(1.5 + percentage * 2 ) * Math.PI);
cr.stroke ();
}
Expand Down
2 changes: 1 addition & 1 deletion core/Widgets/ContextMenu/MenuItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class Widgets.ContextMenu.MenuItem : Gtk.Button {
public string secondary_text {
set {
secondary_label.label = value;
secondary_label_revealer.reveal_child = value.length > 0;
secondary_label_revealer.reveal_child = value.length > 0;
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/Widgets/DynamicIcon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public class Widgets.DynamicIcon : Adw.Bin {
private Gtk.Image icon;

public DynamicIcon () {
Object(
Object (
halign: Gtk.Align.CENTER,
valign: Gtk.Align.CENTER
);
}

public DynamicIcon.from_icon_name (string icon_name) {
Object(
Object (
halign: Gtk.Align.CENTER,
valign: Gtk.Align.CENTER,
icon_name: icon_name
Expand Down
4 changes: 2 additions & 2 deletions core/Widgets/LabelPicker/LabelPicker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public class Widgets.LabelPicker.LabelPicker : Gtk.Popover {
public Gee.HashMap <string, Widgets.LabelPicker.LabelRow> labels_widgets_map = new Gee.HashMap <string, Widgets.LabelPicker.LabelRow> ();
public Gee.HashMap<string, Objects.Label> picked = new Gee.HashMap<string, Objects.Label> ();

private string PLACEHOLDER_MESSAGE = _("Your list of filters will show up here. Create one by entering the name and pressing the Enter key.");
private string PLACEHOLDER_CREATE_MESSAGE = _("Create '%s'");
private string PLACEHOLDER_MESSAGE = _("Your list of filters will show up here. Create one by entering the name and pressing the Enter key."); // vala-lint=naming-convention
private string PLACEHOLDER_CREATE_MESSAGE = _("Create '%s'"); // vala-lint=naming-convention

public LabelPicker () {
Object (
Expand Down
3 changes: 1 addition & 2 deletions src/App.vala
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ public class Planify : Adw.Application {
}

string reason = _(
"Planify will automatically start when this device turns on " +
"and run when its window is closed so that it can send to-do notifications.");
"Planify will automatically start when this device turns on " + "and run when its window is closed so that it can send to-do notifications.");
var command = new GenericArray<unowned string> (2);
foreach (unowned var arg in DAEMON_COMMAND) {
command.add (arg);
Expand Down
Loading

0 comments on commit 5057ea2

Please sign in to comment.