1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 18:29:17 +02:00

Adding standard since its quite similar to the current style and removes the maintenance burden, while also making it easier to follow for contributors.

Over the time replace JSHint.
This commit is contained in:
Gunther Brunner 2015-07-28 16:26:50 +09:00
parent 361bf9caea
commit 142866838c
5 changed files with 29 additions and 19 deletions

View file

@ -2,6 +2,7 @@ var gulp = require('gulp')
var gutil = require('gulp-util') var gutil = require('gulp-util')
var jshint = require('gulp-jshint') var jshint = require('gulp-jshint')
var jsonlint = require('gulp-jsonlint') var jsonlint = require('gulp-jsonlint')
var standard = require('gulp-standard')
var webpack = require('webpack') var webpack = require('webpack')
var ngAnnotatePlugin = require('ng-annotate-webpack-plugin') var ngAnnotatePlugin = require('ng-annotate-webpack-plugin')
var webpackConfig = require('./webpack.config').webpack var webpackConfig = require('./webpack.config').webpack
@ -46,6 +47,15 @@ gulp.task('jscs', function () {
.pipe(jscs()) .pipe(jscs())
}); });
gulp.task('standard', function () {
// Check res/app for now
return gulp.src(['res/app/**/*.js', '!**/*-spec.js'])
.pipe(standard())
.pipe(standard.reporter('default', {
breakOnError: true
}))
})
gulp.task('lint', ['jshint', 'jsonlint']) gulp.task('lint', ['jshint', 'jsonlint'])
gulp.task('test', ['lint', 'run:checkversion']) gulp.task('test', ['lint', 'run:checkversion'])

View file

@ -95,6 +95,7 @@
"gulp-jsonlint": "^1.0.2", "gulp-jsonlint": "^1.0.2",
"gulp-protractor": "^1.0.0", "gulp-protractor": "^1.0.0",
"gulp-run": "^1.6.10", "gulp-run": "^1.6.10",
"gulp-standard": "^4.5.3",
"gulp-util": "^3.0.4", "gulp-util": "^3.0.4",
"html-loader": "^0.3.0", "html-loader": "^0.3.0",
"imports-loader": "^0.6.3", "imports-loader": "^0.6.3",

View file

@ -20,7 +20,7 @@ require.ensure([], function (require) {
require('stf/standalone').name require('stf/standalone').name
]) ])
.config(function ($routeProvider, $locationProvider) { .config(function ($routeProvider, $locationProvider) {
$locationProvider.hashPrefix('!'); $locationProvider.hashPrefix('!')
$routeProvider $routeProvider
.otherwise({ .otherwise({
redirectTo: '/devices' redirectTo: '/devices'

View file

@ -1,5 +1,5 @@
module.exports = module.exports =
function ControlPanesController($scope, $http, gettext, $routeParams, function ControlPanesController ($scope, $http, gettext, $routeParams,
$timeout, $location, DeviceService, GroupService, ControlService, $timeout, $location, DeviceService, GroupService, ControlService,
StorageService, FatalMessageService, SettingsService) { StorageService, FatalMessageService, SettingsService) {
@ -39,7 +39,6 @@ module.exports =
} }
].concat(angular.copy(sharedTabs)) ].concat(angular.copy(sharedTabs))
$scope.belowTabs = [ $scope.belowTabs = [
{ {
title: gettext('Logs'), title: gettext('Logs'),
@ -53,7 +52,7 @@ module.exports =
$scope.control = null $scope.control = null
// TODO: Move this out to Ctrl.resolve // TODO: Move this out to Ctrl.resolve
function getDevice(serial) { function getDevice (serial) {
DeviceService.get(serial, $scope) DeviceService.get(serial, $scope)
.then(function (device) { .then(function (device) {
return GroupService.invite(device) return GroupService.invite(device)
@ -63,7 +62,7 @@ module.exports =
$scope.control = ControlService.create(device, device.channel) $scope.control = ControlService.create(device, device.channel)
// TODO: Change title, flickers too much on Chrome // TODO: Change title, flickers too much on Chrome
//$rootScope.pageTitle = device.name // $rootScope.pageTitle = device.name
SettingsService.set('lastUsedDevice', serial) SettingsService.set('lastUsedDevice', serial)

View file

@ -10,12 +10,12 @@ module.exports =
}, },
nextDevice: function () { nextDevice: function () {
console.log('next') console.log('next')
// console.log('$scope.groupTracker.devices', $scope.groupTracker.devices) // console.log('$scope.groupTracker.devices', $scope.groupTracker.devices)
//console.log('$scope.groupTracker.devices', $scope.groupDevices) // console.log('$scope.groupTracker.devices', $scope.groupDevices)
//groupDevice in $scope.groupTracker.devices // groupDevice in $scope.groupTracker.devices
//groupDevice.serial === device.serial // groupDevice.serial === device.serial
//$location.path('/control/' + device.serial) // $location.path('/control/' + device.serial)
}, },
deviceList: function () { deviceList: function () {
$location.path('/devices/') $location.path('/devices/')
@ -75,7 +75,7 @@ module.exports =
$scope.control.back() $scope.control.back()
}, },
toggleDevice: function () { toggleDevice: function () {
//$scope.controlScreen.show = !$scope.controlScreen.show // $scope.controlScreen.show = !$scope.controlScreen.show
}, },
togglePlatform: function () { togglePlatform: function () {
if ($rootScope.platform === 'web') { if ($rootScope.platform === 'web') {
@ -90,26 +90,26 @@ module.exports =
} }
ScopedHotkeysService($scope, [ ScopedHotkeysService($scope, [
//['shift+up', gettext('Previous Device'), actions.previousDevice], // ['shift+up', gettext('Previous Device'), actions.previousDevice],
//['shift+down', gettext('Next Device'), actions.nextDevice], // ['shift+down', gettext('Next Device'), actions.nextDevice],
['command+shift+d', gettext('Go to Device List'), actions.deviceList], ['command+shift+d', gettext('Go to Device List'), actions.deviceList],
['shift+space', gettext('Selects Next IME'), actions.switchCharset], ['shift+space', gettext('Selects Next IME'), actions.switchCharset],
['command+left', gettext('Rotate Left'), actions.rotateLeft], ['command+left', gettext('Rotate Left'), actions.rotateLeft],
['command+right', gettext('Rotate Right'), actions.rotateRight], ['command+right', gettext('Rotate Right'), actions.rotateRight],
//['command+1', gettext('Scale 100%'), actions.scale], // ['command+1', gettext('Scale 100%'), actions.scale],
//['command+2', gettext('Scale 75%'), actions.scale], // ['command+2', gettext('Scale 75%'), actions.scale],
//['command+3', gettext('Scale 50%'), actions.scale], // ['command+3', gettext('Scale 50%'), actions.scale],
//['shift+l', gettext('Focus URL bar'), actions.focusUrlBar], // ['shift+l', gettext('Focus URL bar'), actions.focusUrlBar],
//['shift+s', gettext('Take Screenshot'), actions.takeScreenShot], // ['shift+s', gettext('Take Screenshot'), actions.takeScreenShot],
['command+shift+m', gettext('Press Menu button'), actions.pressMenu], ['command+shift+m', gettext('Press Menu button'), actions.pressMenu],
['command+shift+h', gettext('Press Home button'), actions.pressHome], ['command+shift+h', gettext('Press Home button'), actions.pressHome],
['command+shift+b', gettext('Press Back button'), actions.pressBack], ['command+shift+b', gettext('Press Back button'), actions.pressBack],
//['shift+i', gettext('Show/Hide device'), actions.toggleDevice], // ['shift+i', gettext('Show/Hide device'), actions.toggleDevice],
['shift+w', gettext('Toggle Web/Native'), actions.togglePlatform, false] ['shift+w', gettext('Toggle Web/Native'), actions.togglePlatform, false]
]) ])
} }