DartLinter: Add unnecessary_this

This commit is contained in:
Vishesh Handa
2019-02-23 01:33:34 +01:00
parent bad9aa2bd9
commit 8ff5d02033
13 changed files with 38 additions and 38 deletions

View File

@ -114,7 +114,7 @@ linter:
- unnecessary_null_in_if_null_operators - unnecessary_null_in_if_null_operators
# - unnecessary_overrides # https://github.com/dart-lang/linter/issues/626 and https://github.com/dart-lang/linter/issues/627 # - unnecessary_overrides # https://github.com/dart-lang/linter/issues/626 and https://github.com/dart-lang/linter/issues/627
- unnecessary_statements - unnecessary_statements
# - unnecessary_this - unnecessary_this
- use_rethrow_when_possible - use_rethrow_when_possible
# - use_setters_to_change_properties # not yet tested # - use_setters_to_change_properties # not yet tested
# - use_string_buffers # https://github.com/dart-lang/linter/pull/664 # - use_string_buffers # https://github.com/dart-lang/linter/pull/664

View File

@ -33,9 +33,9 @@ class GitHub implements GitHost {
callback(GitHostException.OAuthFailed); callback(GitHostException.OAuthFailed);
} }
this._accessCode = await _getAccessCode(authCode); _accessCode = await _getAccessCode(authCode);
if (this._accessCode == null || this._accessCode.isEmpty) { if (_accessCode == null || _accessCode.isEmpty) {
print("GitHub: AccessCode is invalid: " + this._accessCode); print("GitHub: AccessCode is invalid: " + _accessCode);
callback(GitHostException.OAuthFailed); callback(GitHostException.OAuthFailed);
} }

View File

@ -28,13 +28,13 @@ class GitApp extends StatelessWidget {
void _sendSuccess() { void _sendSuccess() {
var text = "Success"; var text = "Success";
this._scaffoldKey.currentState _scaffoldKey.currentState
..removeCurrentSnackBar() ..removeCurrentSnackBar()
..showSnackBar(SnackBar(content: Text(text))); ..showSnackBar(SnackBar(content: Text(text)));
} }
void _sendError(String text) { void _sendError(String text) {
this._scaffoldKey.currentState _scaffoldKey.currentState
..removeCurrentSnackBar() ..removeCurrentSnackBar()
..showSnackBar(SnackBar(content: Text("ERROR: " + text))); ..showSnackBar(SnackBar(content: Text("ERROR: " + text)));
} }

View File

@ -50,7 +50,7 @@ class GitHostSetupAutoConfigureState extends State<GitHostSetupAutoConfigure> {
GitRepo repo; GitRepo repo;
try { try {
this.setState(() { setState(() {
_message = "Creating private repo"; _message = "Creating private repo";
}); });
@ -61,18 +61,18 @@ class GitHostSetupAutoConfigureState extends State<GitHostSetupAutoConfigure> {
rethrow; rethrow;
} }
this.setState(() { setState(() {
_message = "Using existing repo"; _message = "Using existing repo";
}); });
repo = await gitHost.getRepo("journal"); repo = await gitHost.getRepo("journal");
} }
this.setState(() { setState(() {
_message = "Generating SSH Key"; _message = "Generating SSH Key";
}); });
var publicKey = await generateSSHKeys(comment: "GitJournal"); var publicKey = await generateSSHKeys(comment: "GitJournal");
this.setState(() { setState(() {
_message = "Adding as a Deploy Key"; _message = "Adding as a Deploy Key";
}); });
await gitHost.addDeployKey(publicKey, repo.fullName); await gitHost.addDeployKey(publicKey, repo.fullName);
@ -105,7 +105,7 @@ class GitHostSetupAutoConfigureState extends State<GitHostSetupAutoConfigure> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (_configuringStarted) { if (_configuringStarted) {
if (this.errorMessage == null || this.errorMessage.isEmpty) { if (errorMessage == null || errorMessage.isEmpty) {
return GitHostSetupLoadingPage(_message); return GitHostSetupLoadingPage(_message);
} }

View File

@ -24,7 +24,7 @@ class GitHostSetupButton extends StatelessWidget {
style: Theme.of(context).textTheme.button, style: Theme.of(context).textTheme.button,
), ),
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
onPressed: this._onPressedWithAnalytics, onPressed: _onPressedWithAnalytics,
), ),
); );
} else { } else {
@ -38,7 +38,7 @@ class GitHostSetupButton extends StatelessWidget {
), ),
icon: Image.asset(iconUrl, width: 32, height: 32), icon: Image.asset(iconUrl, width: 32, height: 32),
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
onPressed: this._onPressedWithAnalytics, onPressed: _onPressedWithAnalytics,
), ),
); );
} }

View File

@ -12,7 +12,7 @@ class GitHostSetupGitClone extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (this.errorMessage == null || this.errorMessage.isEmpty) { if (errorMessage == null || errorMessage.isEmpty) {
return GitHostSetupLoadingPage("Cloning ..."); return GitHostSetupLoadingPage("Cloning ...");
} }

View File

@ -33,7 +33,7 @@ class GitCloneUrlPageState extends State<GitCloneUrlPage> {
_formKey.currentState.save(); _formKey.currentState.save();
var url = sshUrlKey.currentState.value; var url = sshUrlKey.currentState.value;
this.widget.doneFunction(url.trim()); widget.doneFunction(url.trim());
inputFormFocus.unfocus(); inputFormFocus.unfocus();
} }
}; };
@ -129,7 +129,7 @@ class GitCloneUrlKnownProviderPageState
_formKey.currentState.save(); _formKey.currentState.save();
var url = sshUrlKey.currentState.value; var url = sshUrlKey.currentState.value;
this.widget.doneFunction(url.trim()); widget.doneFunction(url.trim());
inputFormFocus.unfocus(); inputFormFocus.unfocus();
} }
}; };

View File

@ -466,7 +466,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
parameters: <String, dynamic>{}, parameters: <String, dynamic>{},
); );
Navigator.pop(context); Navigator.pop(context);
this.widget.onCompletedFunction(folder); widget.onCompletedFunction(folder);
} }
} }

View File

@ -19,7 +19,7 @@ class GitHostSetupSshKeyKnownProvider extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (this.publicKey == null || this.publicKey.isEmpty) { if (publicKey == null || publicKey.isEmpty) {
return GitHostSetupLoadingPage("Generating SSH Key ..."); return GitHostSetupLoadingPage("Generating SSH Key ...");
} }
@ -67,7 +67,7 @@ class GitHostSetupSshKeyKnownProvider extends StatelessWidget {
SizedBox(height: 8.0), SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "Clone Repo", text: "Clone Repo",
onPressed: this.doneFunction, onPressed: doneFunction,
), ),
], ],
); );
@ -93,7 +93,7 @@ class GitHostSetupSshKeyUnknownProvider extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (this.publicKey == null || this.publicKey.isEmpty) { if (publicKey == null || publicKey.isEmpty) {
return GitHostSetupLoadingPage("Generating SSH Key ..."); return GitHostSetupLoadingPage("Generating SSH Key ...");
} }
@ -136,7 +136,7 @@ class GitHostSetupSshKeyUnknownProvider extends StatelessWidget {
SizedBox(height: 8.0), SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "Clone Repo", text: "Clone Repo",
onPressed: this.doneFunction, onPressed: doneFunction,
), ),
], ],
); );

View File

@ -57,8 +57,8 @@ class NoteEditorState extends State<NoteEditor> {
icon: Icon(Icons.check), icon: Icon(Icons.check),
onPressed: () { onPressed: () {
final stateContainer = StateContainer.of(context); final stateContainer = StateContainer.of(context);
this.note.body = _textController.text; note.body = _textController.text;
if (this.note.body.isNotEmpty) { if (note.body.isNotEmpty) {
newNote newNote
? stateContainer.addNote(note) ? stateContainer.addNote(note)
: stateContainer.updateNote(note); : stateContainer.updateNote(note);

View File

@ -151,7 +151,7 @@ class StateContainerState extends State<StateContainer> {
} }
print("Starting to syncNotes"); print("Starting to syncNotes");
this.noteRepo.sync().then((loaded) { noteRepo.sync().then((loaded) {
print("NotesRepo Synced: " + loaded.toString()); print("NotesRepo Synced: " + loaded.toString());
_loadNotesFromDisk(); _loadNotesFromDisk();
}).catchError((err) { }).catchError((err) {
@ -230,9 +230,9 @@ class StateContainerState extends State<StateContainer> {
void completeGitHostSetup(String subFolder) { void completeGitHostSetup(String subFolder) {
setState(() async { setState(() async {
this.appState.remoteGitRepoConfigured = true; appState.remoteGitRepoConfigured = true;
this.appState.remoteGitRepoFolderName = "journal"; appState.remoteGitRepoFolderName = "journal";
this.appState.remoteGitRepoSubFolder = subFolder; appState.remoteGitRepoSubFolder = subFolder;
await migrateGitRepo( await migrateGitRepo(
fromGitBasePath: appState.localGitRepoPath, fromGitBasePath: appState.localGitRepoPath,
@ -255,7 +255,7 @@ class StateContainerState extends State<StateContainer> {
void completeOnBoarding() { void completeOnBoarding() {
setState(() { setState(() {
this.appState.onBoardingCompleted = true; appState.onBoardingCompleted = true;
_persistConfig(); _persistConfig();
}); });
} }

View File

@ -19,9 +19,9 @@ class FileStorage implements NoteRepository {
@required this.baseDirectory, @required this.baseDirectory,
@required this.noteSerializer, @required this.noteSerializer,
}) { }) {
assert(this.baseDirectory != null); assert(baseDirectory != null);
assert(this.baseDirectory.isNotEmpty); assert(baseDirectory.isNotEmpty);
print("FileStorage Directory: " + this.baseDirectory); print("FileStorage Directory: " + baseDirectory);
} }
@override @override

View File

@ -40,9 +40,9 @@ class GitNoteRepository implements NoteRepository {
var baseDir = _fileStorage.baseDirectory; var baseDir = _fileStorage.baseDirectory;
var filePath = result.noteFilePath.replaceFirst(baseDir + "/", ""); var filePath = result.noteFilePath.replaceFirst(baseDir + "/", "");
await gitAdd(this.dirName, filePath); await gitAdd(dirName, filePath);
await gitCommit( await gitCommit(
gitFolder: this.dirName, gitFolder: dirName,
authorEmail: Settings.instance.gitAuthorEmail, authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor, authorName: Settings.instance.gitAuthor,
message: commitMessage, message: commitMessage,
@ -62,9 +62,9 @@ class GitNoteRepository implements NoteRepository {
var baseDir = _fileStorage.baseDirectory; var baseDir = _fileStorage.baseDirectory;
var filePath = result.noteFilePath.replaceFirst(baseDir + "/", ""); var filePath = result.noteFilePath.replaceFirst(baseDir + "/", "");
await gitRm(this.dirName, filePath); await gitRm(dirName, filePath);
await gitCommit( await gitCommit(
gitFolder: this.dirName, gitFolder: dirName,
authorEmail: Settings.instance.gitAuthorEmail, authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor, authorName: Settings.instance.gitAuthor,
message: "Removed Journal entry", message: "Removed Journal entry",
@ -74,7 +74,7 @@ class GitNoteRepository implements NoteRepository {
} }
Future<NoteRepoResult> resetLastCommit() async { Future<NoteRepoResult> resetLastCommit() async {
await gitResetLast(this.dirName); await gitResetLast(dirName);
return NoteRepoResult(error: false); return NoteRepoResult(error: false);
} }
@ -91,13 +91,13 @@ class GitNoteRepository implements NoteRepository {
@override @override
Future<bool> sync() async { Future<bool> sync() async {
try { try {
await gitPull(this.dirName); await gitPull(dirName);
} on GitException catch (ex) { } on GitException catch (ex) {
print(ex); print(ex);
} }
try { try {
await gitPush(this.dirName); await gitPush(dirName);
} on GitException catch (ex) { } on GitException catch (ex) {
print(ex); print(ex);
rethrow; rethrow;