Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
Lint with Vala-Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ryonakano committed Mar 3, 2020
1 parent a3bc671 commit a4556fd
Show file tree
Hide file tree
Showing 35 changed files with 1,214 additions and 1,218 deletions.
6 changes: 3 additions & 3 deletions src/Actions/ProjectEditing/Actions.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
* Authored by: alcadica <[email protected]>
*/
namespace Alcadica.Actions.ProjectEditing {
public const string TEMPLATE_DID_COPY = "Alcadica.Actions.ProjectEditing.TEMPLATE_DID_COPY";
public const string TEMPLATE_DIDNOT_COPY = "Alcadica.Actions.ProjectEditing.TEMPLATE_DIDNOT_COPY";
}
public const string TEMPLATE_DID_COPY = "Alcadica.Actions.ProjectEditing.TEMPLATE_DID_COPY";
public const string TEMPLATE_DIDNOT_COPY = "Alcadica.Actions.ProjectEditing.TEMPLATE_DIDNOT_COPY";
}
16 changes: 8 additions & 8 deletions src/Actions/Window/Actions.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
* Authored by: alcadica <[email protected]>
*/
namespace Alcadica.Actions.Window {
public const string FIRST_RUN = "Alcadica.Actions.Window.FIRST_RUN";
public const string FIRST_RUN_END = "Alcadica.Actions.Window.FIRST_RUN_END";
public const string QUIT = "Alcadica.Actions.Window.QUIT";
public const string SETTINGS_CLOSE = "Alcadica.Actions.Window.SETTINGS_CLOSE";
public const string SETTINGS_OPEN = "Alcadica.Actions.Window.SETTINGS_OPEN";
public const string START = "Alcadica.Actions.Window.START";
public const string SHOW_WELCOME_VIEW = "Alcadica.Actions.Window.SHOW_WELCOME_VIEW";
}
public const string FIRST_RUN = "Alcadica.Actions.Window.FIRST_RUN";
public const string FIRST_RUN_END = "Alcadica.Actions.Window.FIRST_RUN_END";
public const string QUIT = "Alcadica.Actions.Window.QUIT";
public const string SETTINGS_CLOSE = "Alcadica.Actions.Window.SETTINGS_CLOSE";
public const string SETTINGS_OPEN = "Alcadica.Actions.Window.SETTINGS_OPEN";
public const string START = "Alcadica.Actions.Window.START";
public const string SHOW_WELCOME_VIEW = "Alcadica.Actions.Window.SHOW_WELCOME_VIEW";
}
9 changes: 4 additions & 5 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*
* Authored by: alcadica <[email protected]>
*/
using Gtk;

namespace Alcadica {

Expand All @@ -35,9 +34,9 @@ namespace Alcadica {
return _instance;
}
}

public Develop () {
Object(
Object (
application_id: APP_ID
);
Intl.setlocale (LocaleCategory.ALL, "");
Expand All @@ -54,9 +53,9 @@ namespace Alcadica {
var settings = new Services.UserSettings ();

Services.FileSystem.window = window;

window.set_titlebar (new Views.Partials.Window.HeaderBar ());

window.title = APP_NAME;
window.add (main);
window.show_all ();
Expand Down
10 changes: 5 additions & 5 deletions src/CommonRegEx.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
* Authored by: alcadica <[email protected]>
*/

namespace Alcadica.CommonRegEx {
public const string PROJECT_NAME = "^[a-z\\-A-Z]+[a-z\\-A-Z0-9]+$";
public const string USER_NAME = "^([a-zA-Z]+[0-9\\s]{0,})+[^\\s]$";
public const string USER_EMAIL = "^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]{1}|[\\w-]{2,}))@((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]? [0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]? [0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|([a-zA-Z0-9]+[\\w-]+\\.)+[a-zA-Z]{1}[a-zA-Z0-9-]{1,23})$";
public const string URL = "^https?://(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)$";
namespace Alcadica.CommonRegEx {
public const string PROJECT_NAME = "^[a-z\\-A-Z]+[a-z\\-A-Z0-9]+$";
public const string USER_NAME = "^([a-zA-Z]+[0-9\\s]{0,})+[^\\s]$";
public const string USER_EMAIL = "^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]{1}|[\\w-]{2,}))@((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]? [0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]? [0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|([a-zA-Z0-9]+[\\w-]+\\.)+[a-zA-Z]{1}[a-zA-Z0-9-]{1,23})$";
public const string URL = "^https?://(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)$";
}
18 changes: 9 additions & 9 deletions src/Entities/Generic/KeyValuePair.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
*
* Authored by: alcadica <[email protected]>
*/
namespace Alcadica.Entities.Generic {
namespace Alcadica.Entities.Generic {
public class KeyValuePair<TKey, TValue> : Object {
public TKey key { get; set; }
public TValue value { get; set; }
public TKey key { get; set; }
public TValue value { get; set; }

public KeyValuePair(TKey key, TValue value) {
this.key = key;
this.value = value;
}
}
}
public KeyValuePair (TKey key, TValue value) {
this.key = key;
this.value = value;
}
}
}
6 changes: 3 additions & 3 deletions src/Entities/Template/TemplateFile.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
*
* Authored by: alcadica <[email protected]>
*/
namespace Alcadica.Entities.Template {
public class TemplateFile : Object {
namespace Alcadica.Entities.Template {
public class TemplateFile : Object {
public string content { get; set; }
public string path { get; set; }
public TemplateFileType file_type { get; set; }
}
}
}
10 changes: 5 additions & 5 deletions src/Entities/Template/TemplateFileType.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*
* Authored by: alcadica <[email protected]>
*/
namespace Alcadica.Entities.Template {
namespace Alcadica.Entities.Template {
public enum TemplateFileType {
Directory,
File
}
}
DIRECTORY,
FILE
}
}
24 changes: 12 additions & 12 deletions src/Entities/Template/TemplateToken.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
*
* Authored by: alcadica <[email protected]>
*/
namespace Alcadica.Entities.Template {
public class TemplateToken : Object {
public static string delimiter_start = "{{";
public static string delimiter_end = "}}";
namespace Alcadica.Entities.Template {
public class TemplateToken : Object {
public static string delimiter_start = "{{";
public static string delimiter_end = "}}";

public string token { get; set; }
public string token_value { get; set; }
public string token { get; set; }
public string token_value { get; set; }

public TemplateToken (string name, string token_value) {
this.token = TemplateToken.delimiter_start + name + TemplateToken.delimiter_end;
this.token_value = token_value;
}
}
}
public TemplateToken (string name, string token_value) {
this.token = TemplateToken.delimiter_start + name + TemplateToken.delimiter_end;
this.token_value = token_value;
}
}
}
84 changes: 42 additions & 42 deletions src/Services/ActionManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,45 @@
* Authored by: alcadica <[email protected]>
*/
namespace Alcadica.Services {
public class ActionManager : Object {
private static ActionManager _instance = null;

public static ActionManager instance {
get {
if (_instance == null) {
_instance = new ActionManager ();
}
return _instance;
}
}

public SimpleActionGroup action_group { get; construct; }

private ActionManager () {
Object (
action_group: new SimpleActionGroup ()
);
}

public void add (string name) {
SimpleAction action = new SimpleAction (name, null);
this.action_group.add_action (action);
}

public SimpleAction get_action (string name) {
if (!this.action_group.has_action (name)) {
this.add (name);
}
return this.action_group.lookup_action (name) as SimpleAction;
}

public void dispatch (string name) {
this.action_group.activate_action (name, null);
}

public void remove (string name) {
this.action_group.remove_action (name);
}
}
}
public class ActionManager : Object {
private static ActionManager _instance = null;

public static ActionManager instance {
get {
if (_instance == null) {
_instance = new ActionManager ();
}
return _instance;
}
}

public SimpleActionGroup action_group { get; construct; }

private ActionManager () {
Object (
action_group: new SimpleActionGroup ()
);
}

public void add (string name) {
SimpleAction action = new SimpleAction (name, null);
this.action_group.add_action (action);
}

public SimpleAction get_action (string name) {
if (!this.action_group.has_action (name)) {
this.add (name);
}

return this.action_group.lookup_action (name) as SimpleAction;
}

public void dispatch (string name) {
this.action_group.activate_action (name, null);
}

public void remove (string name) {
this.action_group.remove_action (name);
}
}
}
32 changes: 16 additions & 16 deletions src/Services/FileSystem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
using Gtk;

namespace Alcadica.Services {
namespace Alcadica.Services {
public class FileSystem : GLib.Object {

public static ApplicationWindow window { get; set; }
Expand All @@ -39,13 +39,13 @@ namespace Alcadica.Services {
public static string choose_directory (string title) {
return FileSystem.choose_directories (title).nth_data (0);
}

public static List<string> choose_directories (string title) {
List<string> list = new List<string>();
List<string> list = new List<string> ();

Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog (
title,
FileSystem.window,
title,
FileSystem.window,
FileChooserAction.SELECT_FOLDER,
"_Cancel",
Gtk.ResponseType.CANCEL,
Expand All @@ -71,20 +71,20 @@ namespace Alcadica.Services {

return list;
}

public static bool dir_exists (string path) {
var file = File.new_for_path (path);

if (file.query_exists ()) {
return file.query_file_type (FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null) == FileType.DIRECTORY;
}

return false;
}

public static bool file_exists (string path) {
var file = File.new_for_path (path);

if (file.query_exists ()) {
switch (file.query_file_type (0)) {
case FileType.MOUNTABLE:
Expand All @@ -98,10 +98,10 @@ namespace Alcadica.Services {
return false;
}
}

return false;
}

public static bool mkdir (string path) {
if (dir_exists (path)) {
return false;
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace Alcadica.Services {
}

File newfile = File.new_for_path (path.replace (file.get_basename (), filename));

try {
return file.move (newfile, flags);
} catch (Error error) {
Expand All @@ -156,14 +156,14 @@ namespace Alcadica.Services {
if (file_exists (path)) {
return false;
}

try {
File file = File.new_for_path (path);
var dos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));

uint8[] data = content.data;
long written = 0;
while (written < data.length) {
while (written < data.length) {
written += dos.write (data[written:data.length]);
}
return true;
Expand All @@ -173,4 +173,4 @@ namespace Alcadica.Services {
}
}
}
}
}
Loading

0 comments on commit a4556fd

Please sign in to comment.