Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting #5790

Merged
merged 1 commit into from
Sep 20, 2018
Merged

Linting #5790

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,6 @@ describe('ExploreResultsButton', () => {
expect(wrapper.find(Button)).to.have.length(1);
});

describe('getColumnFromProps', () => {
it('should require valid query parameter in props', () => {
const emptyQuery = {
database,
show: true,
query: {},
};
const wrapper = shallow(<ExploreResultsButton {...emptyQuery} />, {
context: { store },
}).dive();
expect(wrapper.state().hints).to.deep.equal([]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hints was unused in the component.

});
});

describe('datasourceName', () => {
let wrapper;
let stub;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ const defaultProps = {
class ExploreResultsButton extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
hints: [],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hints is unused in the component

};
this.visualize = this.visualize.bind(this);
this.onClick = this.onClick.bind(this);
this.getInvalidColumns = this.getInvalidColumns.bind(this);
Expand Down
1 change: 0 additions & 1 deletion superset/assets/src/dashboard/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class Header extends React.PureComponent {
this.state = {
didNotifyMaxUndoHistoryToast: false,
emphasizeUndo: false,
hightlightRedo: false,
};

this.handleChangeText = this.handleChangeText.bind(this);
Expand Down
5 changes: 0 additions & 5 deletions superset/assets/src/datasource/DatasourceEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ export class DatasourceEditor extends React.PureComponent {
super(props);
this.state = {
datasource: props.datasource,
showAlert: true,
errors: [],
isDruid: props.datasource.type === 'druid',
isSqla: props.datasource.type === 'table',
Expand All @@ -202,7 +201,6 @@ export class DatasourceEditor extends React.PureComponent {
this.onChange = this.onChange.bind(this);
this.onDatasourcePropChange = this.onDatasourcePropChange.bind(this);
this.onDatasourceChange = this.onDatasourceChange.bind(this);
this.hideAlert = this.hideAlert.bind(this);
this.syncMetadata = this.syncMetadata.bind(this);
this.setColumns = this.setColumns.bind(this);
this.validateAndChange = this.validateAndChange.bind(this);
Expand Down Expand Up @@ -307,9 +305,6 @@ export class DatasourceEditor extends React.PureComponent {

this.setState({ errors }, callback);
}
hideAlert() {
this.setState({ showAlert: false });
}
handleTabSelect(activeTabKey) {
this.setState({ activeTabKey });
}
Expand Down
7 changes: 0 additions & 7 deletions superset/assets/src/datasource/DatasourceModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@ class DatasourceModal extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
showEditDatasource: false,
filter: '',
loading: true,
errors: [],
showDatasource: false,
datasource: props.datasource,
};
this.toggleShowDatasource = this.toggleShowDatasource.bind(this);
this.changeSearch = this.changeSearch.bind(this);
this.setSearchRef = this.setSearchRef.bind(this);
this.onDatasourceChange = this.onDatasourceChange.bind(this);
this.onClickSave = this.onClickSave.bind(this);
Expand Down Expand Up @@ -98,9 +94,6 @@ class DatasourceModal extends React.PureComponent {
toggleShowDatasource() {
this.setState({ showDatasource: !this.state.showDatasource });
}
changeSearch(event) {
this.setState({ filter: event.target.value });
}
renderSaveDialog() {
return (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class DatasourceControl extends React.PureComponent {
super(props);
this.state = {
showEditDatasourceModal: false,
filter: '',
loading: true,
showDatasource: false,
};
Expand Down Expand Up @@ -96,9 +95,6 @@ class DatasourceControl extends React.PureComponent {
toggleModal() {
this.setState({ showModal: !this.state.showModal });
}
changeSearch(event) {
this.setState({ filter: event.target.value });
}
selectDatasource(datasourceId) {
this.setState({ showModal: false });
this.props.onChange(datasourceId);
Expand Down
1 change: 0 additions & 1 deletion superset/assets/src/visualizations/sunburst.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ function Sunburst(element, props) {

// If metrics match, assume we are coloring by category
const metricsMatch = Math.abs(d.m1 - d.m2) < 0.00001;
console.log('metrics', metrics);

gMiddleText.selectAll('*').remove();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Create Date: 2016-05-27 15:03:32.980343

"""
from __future__ import absolute_import
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: puts these inline
from __future__ import absolute_import, division, print_function, unicode_literals

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow it's not the standard and I think the linter would complain. Not quite sure why though.

from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

# revision identifiers, used by Alembic.
revision = '1226819ee0e3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
Create Date: 2018-04-03 08:19:34.098789

"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from alembic import op
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
Expand Down
153 changes: 88 additions & 65 deletions superset/migrations/versions/18e88e1cc004_making_audit_nullable.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
Create Date: 2016-03-13 21:30:24.833107

"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = '18e88e1cc004'
down_revision = '430039611635'

from alembic import op
import sqlalchemy as sa


def upgrade():
try:
Expand All @@ -30,69 +34,88 @@ def upgrade():
op.drop_column('columns', 'created_by_fk')
op.drop_column('columns', 'changed_on')
op.drop_column('columns', 'changed_by_fk')
op.alter_column('css_templates', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('css_templates', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('dashboards', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('dashboards', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'css_templates', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'css_templates', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'dashboards', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'dashboards', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.create_unique_constraint(None, 'dashboards', ['slug'])
op.alter_column('datasources', 'changed_by_fk',
existing_type=sa.INTEGER(),
nullable=True)
op.alter_column('datasources', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('datasources', 'created_by_fk',
existing_type=sa.INTEGER(),
nullable=True)
op.alter_column('datasources', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('dbs', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('dbs', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('slices', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('slices', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('sql_metrics', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('sql_metrics', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('table_columns', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('table_columns', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('tables', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('tables', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('url', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('url', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
### end Alembic commands ###
except:
op.alter_column(
'datasources', 'changed_by_fk',
existing_type=sa.INTEGER(),
nullable=True)
op.alter_column(
'datasources', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'datasources', 'created_by_fk',
existing_type=sa.INTEGER(),
nullable=True)
op.alter_column(
'datasources', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'dbs', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'dbs', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'slices', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'slices', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'sql_metrics', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'sql_metrics', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'table_columns', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'table_columns', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'tables', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'tables', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'url', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'url', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
except Exception:
pass


Expand Down
4 changes: 4 additions & 0 deletions superset/migrations/versions/1d2ddd543133_log_dt.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Create Date: 2016-03-25 14:35:44.642576

"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

# revision identifiers, used by Alembic.
revision = '1d2ddd543133'
Expand Down
26 changes: 15 additions & 11 deletions superset/migrations/versions/1d9e835a84f9_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@
Create Date: 2018-07-16 18:04:07.764659

"""

# revision identifiers, used by Alembic.
revision = '1d9e835a84f9'
down_revision = '3dda56f1c4c6'
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import expression

# revision identifiers, used by Alembic.
revision = '1d9e835a84f9'
down_revision = '3dda56f1c4c6'


def upgrade():
op.add_column(
'dbs',
sa.Column(
'allow_csv_upload',
sa.Boolean(),
nullable=False,
server_default=expression.true()))
'dbs',
sa.Column(
'allow_csv_upload',
sa.Boolean(),
nullable=False,
server_default=expression.true()))


def downgrade():
op.drop_column('dbs', 'allow_csv_upload')

Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json

from alembic import op
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Create Date: 2015-11-21 11:18:00.650587

"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from alembic import op
import sqlalchemy as sa
Expand Down
4 changes: 4 additions & 0 deletions superset/migrations/versions/2fcdcb35e487_saved_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Create Date: 2017-03-29 15:04:35.734190

"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from alembic import op
import sqlalchemy as sa
Expand Down
Loading